代码:

<!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>

 

posted on 2013-06-29 14:19  aparche  阅读(579)  评论(0编辑  收藏  举报