JS 获取元素当前的样式信息

1 HTMLElement.prototype.__defineGetter__("currentStyle", function () {

2     return this.ownerDocument.defaultView.getComputedStyle(this, null);

3 });

 

example:

1 document.body.currentStyle['width']

 

你可能感兴趣的:(js)