zoukankan      html  css  js  c++  java
  • 根据不同浏览器使用不同的css文件

    代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="css/IE6.css"/>
    <title>无标题文档</title>
    <script type="text/javascript" language="javascript">
        function setCss(){
            //根据浏览器来选择CSS  
            if (!window.XMLHttpRequest) {  
               setActiveStyleSheet("IE6.css"); //IE6  
            }else if(window.ActiveXObject){  
                setActiveStyleSheet("IE7.css"); //IE7, 以及IE7+ 
            } else {  
               setActiveStyleSheet("other.css"); //Mozilla FireFox、Safari, etc.  
            }  
         
                
        }
        function setActiveStyleSheet(filename){  
            var path = document.getElementsByTagName("link")[0].href;  
            document.getElementsByTagName("link")[0].href="css/"+filename;
            alert("css/"+filename);   
        } 
        window.onload=setCss;
    </script>
    </head>
    
    <body>
        asdasdasd<br />
    </body>
    </html>
  • 相关阅读:
    P1032 字串变换
    P3203 [HNOI2010]弹飞绵羊
    P3690 【模板】Link Cut Tree (动态树)
    P2147 [SDOI2008]洞穴勘测
    P3950 部落冲突
    Codeforces Round #469 Div. 2题解
    线段树
    SDOI2018退役记
    4.1模拟题
    无旋Treap
  • 原文地址:https://www.cnblogs.com/tianguook/p/3162314.html
Copyright © 2011-2022 走看看