通用于ie和firefox的函數(shù) GetCurrentStyle (obj, prop)
更新時間:2006年12月27日 00:00:00 作者:
function GetCurrentStyle (obj, prop) { if (obj.currentStyle) { return obj.currentStyle[prop]; } else if (window.getComputedStyle) { prop = prop.replace (/([A-Z])/g, "-$1"); prop = prop.toLowerCase (); return window.getComputedStyle (obj, "").getPropertyValue(prop); } return null; }
代碼來自于http://tvweek.com/javascripts/default.js
您可能感興趣的文章:
- (currentStyle)javascript為何有時用style得不到已設(shè)定的CSS的屬性
- javascript 讀取內(nèi)聯(lián)之外的樣式(style、currentStyle、getComputedStyle區(qū)別介紹)
- style、 currentStyle、 runtimeStyle區(qū)別分析
- 獲取css樣式表內(nèi)樣式的js函數(shù)currentStyle(IE),defaultView(FF)
- getComputedStyle與currentStyle獲取樣式(style/class)
- 元素未顯示設(shè)置width/height時IE中使用currentStyle獲取為auto
- JS獲取CSS樣式(style/getComputedStyle/currentStyle)
- 前端學習筆記style,currentStyle,getComputedStyle的用法與區(qū)別
相關(guān)文章
JavaScript數(shù)據(jù)結(jié)構(gòu)之雙向鏈表
這篇文章主要為大家詳細介紹了JavaScript數(shù)據(jù)結(jié)構(gòu)之雙向鏈表,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-03-03