ie6 .7 js 获取class属性

ie6,7中用getAttribute()方法取class总为null 查了一下 原来得用getAttribute(”className”)才能取得 所以 可以

 

 var aa = document.getElementById("dd");
 var a = aa.getAttribute("class") ? 
 aa.getAttribute("class"):aa.getAttribute("className");

类似的还有float属性 都是js 的保留关键字  所以可以这样写

  ie:

document.getElementById("header").style.styleFloat
ff:
document.getElementById("header").style.cssFloat

 

posted @ 2010-12-20 10:59    Views(534)  Comments(0)    收藏  举报