use*_*805 2 javascript right-to-left
我如何读取当前影响不一定是样式的元素的任何属性?一个这样的属性将是"dir".
最近我有类似的问题,你可以使用window.getComputedStyle和element.currentStyle方法获取元素的属性:
var elem = document.getElementById('test');
if (window.getComputedStyle) { // all browsers
cs = window.getComputedStyle(elem, null).getPropertyValue('direction');
} else {
cs = elem.currentStyle.direction; // IE5-8
}
alert(cs);
Run Code Online (Sandbox Code Playgroud)