关于html改变css的方法

window.getComputedStyle(document.getElementById('id'),null).getPropertyValue('width');

window.getComputedStyle获取浏览器最后渲染出来的css样式。

document.getElementById('id')获取一个对象的引用,document.getElementById('id').style能够获取并改写样式,但是不能够获取到样式表的内容。

 

posted on 2022-05-22 23:50  悲鸣的海猫  阅读(246)  评论(0)    收藏  举报