美文网首页
2018-10-10

2018-10-10

作者: 熊熊熊熊丽 | 来源:发表于2018-11-20 21:03 被阅读0次

一、透明度:

opacity:0.3;   //ff chrom 高级浏览器
filter:alpha(opacity=30); //IE

设置透明度的时候也是具有兼容性的:

二、获取行间样式:

obj.style.属性
obj.style[属性]

三、获取非行间样式:(具有兼容性)

getComputedStyle(obj,null)[属性] // chrome
obj.currentStyle(属性)        //IE

四、document.all 获取页面所有元素的集合。

在IE返回的是true,其他浏览器返回的是false。

  function getStyle(obj,style){
    if(obj.currentStyle){
    return obj.currentStyle[style];
    }else{
    return getComputedStyle(obj,null)[style];
    }
   }

相关文章

网友评论

      本文标题:2018-10-10

      本文链接:https://www.haomeiwen.com/subject/yphfqqtx.html