开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜