25.获取css样式中的属性值
获取css样式中的属性值
var div = document.getElementById("a");
var test;
if(div.currentStyle){
test = div.currentStyle;
}else{
test = window.getComputedStyle(div, null);
}
console.log(test["width"]);
var div = document.getElementById("a");
var test;
if(div.currentStyle){
test = div.currentStyle;
}else{
test = window.getComputedStyle(div, null);
}
console.log(test["width"]);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
uniapp的那些坑
1.selectedColor不起作用 1.查看位置是否寫對,與lis同級 2.是否爲16進制,selectedColor寫的rgb不支持 3.是否被其他樣式覆蓋,其他地方也設置過sele