give a var some more 'height' ( 7 Views )
-
Hey there,
I want to add some value (50 px) to rHeight, do you guys know how i can manage this?
Thanks in forward
<script type="text/javascript">
function adjustLayout()
{
// Get natural heights
var cHeight = xHeight("centercontent");
var lHeight = xHeight("leftcontent");
var rHeight = xHeight("rightcontent");
// Find the maximum height
var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
// Assign maximum height to all columns
xHeight("center", maxHeight);
xHeight("left", maxHeight);
xHeight("right", maxHeight);
// Show the footer
xShow("footer");
}
window.onload = function()
{
xAddEventListener(window, "resize", adjustLayout, false);
adjustLayout();
}
</script>
(cem, Virgin Islands, British)
Is the problem that the value of rHeight is a non-numeric value because it contains the unit of measurement e.g. "10px" ?
If that's the case, then this will do the job:
Step-by-step approach:
Code:
var pixVal = rHeight.substring(0,rHeight.length-2);
var newPixVal = parseInt(pixVal) + 50;
rHeight = newPixVal+"px";
All-in-one approach:
Code:
rHeight = parseInt(rHeight.substring(0,rHeight.length-2))+50+"px";
Andy
(zeki, Cocos (Keeling) Islands)
Code:
xHeight("right", maxHeight+50);
did the trick :D
(emine, Turkmenistan)
Well I had to make some assumptions as I wasn't in posession of all the facts :p Glad you sorted it.
Andy
(mehmet0508, Wallis and Futuna)
Related Topics ... (or search in 1.720.883 topics !)
anyway to give a <textarea> a max-height? (6) stuck! var inside var #var#id## (4) creating a class wide var named from another var.. crazy (4) php bug? $_post var stored to $_session var (3) session var & php var name conflict!! (17) oop question $var = & new v $var = new (4) how can i convert a string var to a number var (4) how to strip \n or assign php var to js var? (6) assigning multiline php var to js var? (5)
copyright © 2007-2031 Pfodere.COM ( 4 Pfoyihuee Online )
|