欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript操作css屬性

 更新時(shí)間:2013年12月30日 15:35:10   作者:  
今天因需要用到j(luò)s獲取css屬性,網(wǎng)上搜了半天都不合適的。有一下幾種方法

復(fù)制代碼 代碼如下:

var getstyle = function(elementID,attribute){
 obj = document.getElementById(elementID);
// 前面是IE后面是html的標(biāo)準(zhǔn)
 return obj.currentStyle ? obj.currentStyle[attribute] : document.defaultView.getComputedStyle(obj, false)[attribute];
}

還有一種可以獲取寫(xiě)在html中的style屬性的

復(fù)制代碼 代碼如下:

document.getElementById("elementId").style.paddingLeft;

相關(guān)文章

最新評(píng)論