zoukankan      html  css  js  c++  java
  • javascript判断IE浏览器的版本

    <!--IE浏览器兼容-->
    <script language="javascript">
    function ie(){
    var isIE=!!window.ActiveXObject;
    var isIE6=isIE&&!window.XMLHttpRequest;
    var isIE8=isIE&&!!document.documentMode;
    var isIE7=isIE&&!isIE6&&!isIE8;
    if (isIE)
    {
       if (isIE6){
       var style = document.createElement('link');
       style.href = '/static/skins/ie7/skinIE6.css';
       style.rel = 'stylesheet';
      style.type = 'text/css';
      document.getElementsByTagName('HEAD').item(0).appendChild(style); 
      alert("ie6");
       }
     else if (isIE8)
       {
       var style = document.createElement('link');
       style.href = '/static/skins/ie7/skinIE7.css';
       style.rel = 'stylesheet';
     style.type = 'text/css';
     document.getElementsByTagName('HEAD').item(0).appendChild(style); 
      alert("ie8");
        }
    else if (isIE7)
       {
        var style = document.createElement('link');
       style.href = '/static/skins/ie7/skinIE7.css';
       style.rel = 'stylesheet';
     style.type = 'text/css';
     document.getElementsByTagName('HEAD').item(0).appendChild(style); 
      alert("ie7");
      }
     }

    }

    //第一次页面的加载时候调用事件
    if (window.addEventListener)
        {
            window.addEventListener("load", ie, false);
        }
     else if (window.attachEvent)
     {
            window.attachEvent("onload", ie);
        }
    else{
            window.onload=ie;
      }
    </script>
    <!--结束-->

  • 相关阅读:
    bind函数
    尾置返回类型
    lambda表达式
    C++谓词
    capacity和size
    容器操作可能会使迭代器失效
    特殊的forward_list操作
    向顺序容器添加元素
    swap与assign
    迭代器
  • 原文地址:https://www.cnblogs.com/iloveyoucc/p/2666576.html
Copyright © 2011-2022 走看看