js修改css
转载请注明来源:https://www.cnblogs.com/hookjc/
<style type="text/css">
.style{font-size:9pt;color:#2894fb;}
</style>
<link type="text/css" rel="stylesheet" href="css.css"/>
<script language="">
alert(document.styleSheets[0].rules[0].style.fontSize);//9pt
alert(document.styleSheets(1).href);//css.css
window.setTimeout(functioin(){
document.styleSheets[0].rules[0].style.fontSize=“15pt”;
alert(document.getElementById("mydiv").style.backgroundColor);//#2905fa
alert(document.getElementById("mydiv").currentStyle.color);//#2894fb;
},1000);
</script>
<body>
<div id="mydiv" class="style" style="background-color:#2905fa;">显示内容</div>
</body>