• 转: 根据屏幕分辨率,浏览器调用不同css


    <link type="text/csss" href="" rel="stylesheet"/>

    <link type="text/csss" href="" rel="stylesheet"/>

    <link type="text/csss" href="" rel="stylesheet"/>

    <script type="text/javascript">

    if (window.navigator.userAgent.indexOf("MSIE")>=1) 
      { 
        var ie600="ie1.css"; 
        var ie768="ie2.css"; 
        var ie864="ie3.css";
        var ie960="ie4.css"; 
        var ieOtherother="ie6.css";
        ScreenWidth(ie600,ie768,ie864,ie960,ieOtherother);
      }else{ 
       //if (window.navigator.userAgent.indexOf("Firefox")>=1) { 
        //如果浏览器为Firefox 
       // var Firefox1024="style1"; 
       // var Firefox800="style2.css"; 
       // var Firefox1152="css1.css"; 
       // var Firefoxother="css1.css"; 
       // ScreenWidth(Firefox1024,Firefox800,Firefox1152,Firefoxother); 
       //}else{ 
        //如果浏览器为其他 
        var Other600="qita1.css"; 
        var Other768="qita2.css"; 
        var Other864="qita3.css";
        var Other960="qita4.css";
        var Otherother="qita.css";
        ScreenWidth(Other600,Other768,Other864,Other960,Otherother); 
       //} 
      } 
      function ScreenWidth(CSS1,CSS2,CSS3,CSS4,CSS5){ 
       if (screen.height <= 600){ 
        setActiveStyleSheet(CSS1); 
       }else{
        if((screen.height>=600) && (screen.height<=768)){
         setActiveStyleSheet(CSS2);
        }else{
         if ((screen.width >=768) && (screen.height <=864 )){ 
          setActiveStyleSheet(CSS3); 
         }else{ 
          if ((screen.height >= 864) && (screen.height <=960 )){ 
           setActiveStyleSheet(CSS4); 
          }else{ 
           setActiveStyleSheet(CSS5);
          }
         }
        } 
        
       } 
      } 
      function setActiveStyleSheet(title){document.getElementsByTagName("link")[2].href="<%=path %>consultantHelp/css/"+title;}  
      <!--
       //根据浏览器来选择CSS
      // if (!window.XMLHttpRequest) {
      //  setActiveStyleSheet("ie6.css"); //IE6
      // }else if(window.ActiveXObject){
      //  setActiveStyleSheet("ie6.css"); //IE7
      // } else {
      //  setActiveStyleSheet("qita.css"); //Mozilla FireFox、Safari, etc.
      // }
      // function setActiveStyleSheet(filename){
      //  document.getElementsByTagName("link")[2].href="<%=path %>consultantHelp/css/"+filename; 
      // }
       -->
     </script>

  • 相关阅读:
    P2890 [USACO07OPEN]Cheapest Palindrome G 题解
    「NOIP2021模拟赛 By JXC C」位运算 题解
    AT5759 ThREE 题解
    P7532 [USACO21OPEN] Balanced Subsets P 题解
    linux下的pdf分割合并软件
    Python小练习 SDUT 2521 出现次数
    小问题备查持续更新
    Python小练习自动登录人人发送消息并返回好友列表
    Debian系使用小红点
    linux权限问题学习总结
  • 原文地址:https://www.cnblogs.com/jearay/p/3392079.html
Copyright © 2020-2023  润新知