动态改变元素的CSS属性 关于改变CSS
加入如下代码到head区域 <style> .aa{background-color:#ff9966;width:200;color:green;} </style>
加入如下代码到body区域 <span type="button" class="aa" id="sp1">关于改变CSS</span><br> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.color='red'" value="红色"> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.color='blue'" value="蓝色"> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.width='300'" value="300"> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.width='400'" value="400"> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.backgroundColor='#E066FF'" value="背景紫色"> <INPUT TYPE="button" onclick="document.styleSheets[0].rules[0].style.backgroundColor='#F4A460'" value="背景黄色">