最近总结一下最近学的东西 ,想到之前关于样式的获取

内联样式的获取:  1) getComputedStyle(obj)[name]
                           2) obj.currentStyle[name]

 
 

function getCss(obj,name) { if (obj.currentStyle) { // 判断是不是旧版本 return obj.currentStyle[name]; }else{ // [name 是类似于 left 一样的] return getComputedStyle(obj)[name]; } }


行间样式的获取:obj.style.left
写在内联中的样式获取不到

猜你喜欢

转载自blog.csdn.net/q970654226/article/details/80264154
今日推荐