html、jquery判断浏览器,导入不同的css文件

 浏览器是IE6,加载ie6.css;浏览器是IE7及以上版本,加载ie7.css;浏览器非IE,加载notIEcss.css。

 

<link href="index2/style2.css" rel="stylesheet" type="text/css" />
 <!--[if IE 6]><link href="index2/ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
 <!--[if gte IE 7]><link href="index2/ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
<link href="#" id="notIEcssId" rel="stylesheet" type="text/css"/>

<script type="text/javascipt" >

$(document).ready(function(){
  //如果浏览器不是ie,加载notIEccss文件      
 if( ! $.browser.msie) {
        $("#notIEcssId").attr("href","notIEcss.css");
    });

</script>

参考资料:http://www.poluoluo.com/jzxy/201110/145284.html

发布了19 篇原创文章 · 获赞 24 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/w90/article/details/7580975