内联样式的获取: 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
写在内联中的样式获取不到