js用obj.currentStyle和getComputedStyle获取非行间样式的说明

来源:互联网 发布:unity3d人物跳跃 编辑:程序博客网 时间:2024/06/03 13:05

obj.currentStyle 只在ie浏览器里支持 


getComputedStyle 在 firefox chorm safari 浏览器里都支持 


obj.currentStyle 具体的使用方法 如:


var color = obj.currentStyle.backgroundColor //获取obj的背景色




getComputedStyle的具体用法 如:


//第二个参数是为了兼容firefox以前的版本 一般都是false

var width = getComputedStyle(obj,false).width //获取obj的width



原创粉丝点击