要改变的是样式表, 如:
<style>
a.active {
color: red;
}
</style>
<script>
document.styleSheets[0].add('a.active', 'color: blue !important')
<script>
要改变的是样式表, 如:
<style>
a.active {
color: red;
}
</style>
<script>
document.styleSheets[0].add('a.active', 'color: blue !important')
<script>
本文标题:使用 js 改变 css(style) 样式
本文链接:https://www.haomeiwen.com/subject/ukcrgktx.html
网友评论