<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')

相关文章:

  • 2021-06-07
  • 2021-12-08
  • 2022-12-23
  • 2021-12-23
  • 2021-12-10
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
相关资源
相似解决方案