zoukankan      html  css  js  c++  java
  • 处理浏览器兼容你最喜欢用哪种方式

    <script type="text/javascript">
    通过这个盒子的属性名来获取属性值(条件是兼容所有浏览器)
    //var oDiv = document.getElementById("oDiv");
    /*function getCss(curEle,attr) {
    var val = null;
    try {
    val = window.getComputedStyle(curEle,null)[attr];
    }catch (e){
    val = curEle.currentStyle[attr];
    }
    return val;
    }
    console.log(getCss(oDiv,"width"));*/
    /*function getCss(curEle,attr) {
    var val = null;
    if ("getComputedStyle" in window){
    val = window.getComputedStyle(curEle,null)[attr];
    }else {
    val = curEle.currentStyle[attr];
    }
    return val;
    }
    console.log(getCss(oDiv,"width"));*/
    /*function getCss(curEle,attr){
    var val = null;
    if (window.getComputedStyle){
    val = window.getComputedStyle(curEle,null)[attr];
    }else {
    val = curEle.currentStyle[attr];
    }
    return val;
    }
    console.log(getCss(oDiv,"width"));*/
    /*function getCss(curEle,attr){
    var val = null;
    if (/MSIE (6|7|8)/.test(window.navigator.userAgent)){
    val = curEle.currentStyle[attr];
    }else {
    val = window.getComputedStyle(curEle,null)[attr];
    }
    return val;
    }
    console.log(getCss(oDiv,"width"));*/
    </script>
  • 相关阅读:
    css3与gpu加速
    前端集成解决方案小结
    body内html标签的选用
    在win8下快速搭建angularjs测试环境以及可能遇到的问题
    javascript快速排序
    Sublime Text2配置python环境
    python学习第一天
    开机自检
    各种排序算法及c语言实现
    算法表示
  • 原文地址:https://www.cnblogs.com/wuxianqiang/p/6444187.html
Copyright © 2011-2022 走看看