xxx是变量,很奇怪xxx.style.height有的时候管用,有的时候不管用。请问是什么原因呢?
如下代码,我想控制css中#ad的height值来实现隐藏的广告缓缓展开的效果,可是oadcon.style.height根本不管用呀?根本读不到css的height值。请问是怎么回事呢?
第15行弹出为空,什么都没有。
无标题文档
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
oad.currentStyle.height;//IE下获取非行间样式
getComputedStyle(oad,false)//other
因为这样只能获取行间样式
如果要读取css高度,可以使用
Window.getComputedStyle()参考:
Window.getComputedStyle