JavaScript Safari/FireFox browser height
I have this JavaS开发者_JS百科cript code and it does not work in FireFox or Safari with transitional:
var htmlheight = myHeight;
if (myHeight > 0) {
var viewer = document.getElementById("<%= rvControl.ClientID %>");
viewer.style.height = htmlheight - 2 + 'px';
}
It does not appear to work in IE also, so I am a bit dumbfounded!
Can someone tell me how I can change the height of my div
in Safari and FireFox?
Try this:
viewer.style.height = (htmlheight - 2) + 'px'
From the sound of it, your viewer
is an inline element - you cannot set a height on these, it will be ignored (at least in a standards-compliant browser). You should specify either display: block
or display: inline-block
style on it, depending on your layout.
精彩评论