getPropertyValue
来源:互联网 发布:js中怎么使用map 编辑:程序博客网 时间:2024/06/07 12:15
DEMO:
content
<!DOCTYPE html><html><head> <title></title> <meta charset="gbk"> <style type="text/css"> #content { color: red !important;; } </style></head><body><div id="content" style="color:yellow">content</div></body><script type="text/javascript"> var a = document.getElementById("content"); alert("style "+a.style.color); alert("css "+window.getComputedStyle(a).getPropertyValue("color"));</script></html>
如果我们不使用getPropertyValue
方法,直接使用键值访问,其实也是可以的。但是,比如这里的的float
,如果使用键值访问,则不能直接使用getComputedStyle(element, null).float
,而应该是cssFloat
与styleFloat
,自然需要浏览器判断了,比较折腾!
使用getPropertyValue
方法不必可以驼峰书写形式(不支持驼峰写法),例如:style.getPropertyValue("border-top-left-radius")
;
getComputedStyle
方法在伪类元素上的特异功能阅读全文
0 0
- getPropertyValue
- getComputedStyle、currentStyle 和getPropertyValue
- javascript getComputedStyle,getPropertyValue,CurrentStyle说明
- style,getComputedStyle,currentStyle,defaultView,getPropertyValue
- 通过getPropertyValue 取得最终的CSS样式
- mac node 安装
- term查询
- js执行上下文
- UIColor+Hex
- oracle 测试窗口批量删除
- getPropertyValue
- JAVA方法SQL语句执行顺序
- python 正常运行 打包exe出错
- 类间数据量不均衡
- 【mysql】用户管理
- php中的魔术方法
- 进来先放松下嘛,我来开源一首歌曲。
- php 正则表达式
- CNN及其在lenet-5、Alexnet上的应用