obj: 元素對象
attribute: 屬性
返回值:該對象這個屬性的值
function getDefaultStyle(obj,attribute){ // 返回最終樣式函數,兼容IE和DOM,設置參數:元素對象、樣式特性 return obj.currentStyle?obj.currentStyle[attribute]:document.defaultView.getComputedStyle(obj,false)[attribute]; }
完整鏈接:http://www.css88.com/archives/625