<script>
document.body.backgroundColor="red";
document.body.backgroundImage="url(another.jpg)";
</script>
document.body.backgroundColor="red";
document.body.backgroundImage="url(another.jpg)";
</script>
调试欢乐多
我这样写对吗?
可是怎么不行呢??
document.styleSheets[0].rules("a:hover").style.color="red"
处理也是document.styleSheets[0].rules.item(0).style.color="red",
换成你改了的
document.styleSheets[0].rules(".link").style.color="red"
也是document.styleSheets[0].rules.item(0).style.color="red",
本来是不能只用用CSS定义的名称的,但样式表的第一条刚好可以这样做
var a=document.styleSheets[0].rules
for(i=0;i<a.length;i++)
if(a[i].selectorText==".link")a[i].style.color="red"
</script>