利用currentStyle()和ComputedStyle()
function getstyle(obj, key) {
if (obj.currentStyle) {
return obj.currentStyle[key];
} else {
return getComputedStyle(obj, false)[key];
}
}
function getstyle(obj, key) {
if (obj.currentStyle) {
return obj.currentStyle[key];
} else {
return getComputedStyle(obj, false)[key];
}
}
封装进getstyle