JavaScript Safari/FireFox 浏览器高度
我有这段 JavaScript 代码,但它无法在 FireFox 或 Safari 中使用过渡:
var htmlheight = myHeight;
if (myHeight > 0) {
var viewer = document.getElementById("<%= rvControl.ClientID %>");
viewer.style.height = htmlheight - 2 + 'px';
}
它似乎也无法在 IE 中工作,所以我有点傻眼!
有人可以告诉我如何在 Safari 和 FireFox 中更改 div
的高度吗?
I have this JavaScript 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
从它的声音来看,您的查看器是一个内联元素 - 您无法在这些元素上设置高度,它将被忽略(至少在符合标准的浏览器中)。您应该根据您的布局指定
display: block
或display: inline-block
样式。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 eitherdisplay: block
ordisplay: inline-block
style on it, depending on your layout.