<select ></select>
<label for="test2" ></label>
<div class="test3" ></div>
<script type="text/javascript">
var foo=document.getElementById('w1');
var foo2=document.getElementById('w2');
var foo3=document.getElementById('w3');
alert(foo.getAttribute('class')) //w3c
alert(foo.getAttribute('className')) //IE6 7
alert(foo2.getAttribute('for')) //w3c
alert(foo2.getAttribute('htmlFor')) //IE6 7
foo3.style.cssFloat='right' //w3c
foo3.style.styleFloat='right' //IE
foo3.style.opacity='0.5'; //w3c
foo3.style.filter='alpha(opacity=50)' //IE
IE8+ 和其他标准浏览器显示效果相同;值得注意的是label标签,在js中取属性for值的时候,IE6 7 是getAttribute('htmlFor');其他浏览器是getAttribute('for')