开发者

ie7 clientWidth and clientHeight problems

开发者 https://www.devze.com 2023-03-29 17:08 出处:网络
I\'ve tried to get the offsetWidth and offsetHeight properties like so: <div id=\"somediv\" class=\"some_class_with_dimensions\"></div><script...>alert(document.getElementById(\'som

I've tried to get the offsetWidth and offsetHeight properties like so:

<div id="somediv" class="some_class_with_dimensions"></div><script...>alert(document.getElementById('somediv').offsetWidth);</script>

Unfortunately, on IE7 offsetWidth only works if i call in on window.onload, otherwise it just returns 0. Does anyone know any other way around this problem, because i need to immediately work with "somediv" just like in开发者_StackOverflow社区 real browsers.

0

精彩评论

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