代码如下
1.使用oUl.style.height='1000px'可以改变ul的高度,但是为什么使用oUl.setAttribute('height','1000px')却无法改变;
2.将“height”改成title后,也是有效果的。
- 1
- 2
- 3
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
setAttribute()是用来设置element的属性值的,element没有height属性,你可以试一下oUI.setAttribute('style', 'height: 1000px');
ul是没有height属性的但是有title属性
ul有height属性吗?
用 setAttribute 改行内样式应该这么写.
不过这样会覆盖掉原来 style 行内样式.