elem.style只能取该元素的内联样式。如果要取该元素的所有样式(内联,嵌入式,外部),则
ie用:
elem.currentStyle
ff用:
elem.ownerDocument.defaultView.getComputedStyle(elem, null)
统一:
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
return this.ownerDocument.defaultView.getComputedStyle(this, null);
});
之后就可以统一的用
elem.currentStyle