用js判断浏览器是ie还是火狐

用js判断浏览器类型

<html>
<head>
<script type="text/javascript">
  var app=navigator.appName;
  var verStr=navigator.appVersion;
    if (app.indexOf('Netscape') != -1) {
       alert("非ie");
    }
    else if (app.indexOf('Microsoft') != -1) {
        if (verStr.indexOf("MSIE7.0")!=-1 ) {
            alert("ie7");
        } 
        else {
            alert("非ie7");
        }
    } 
</script>
</head>
<body></body>
</html>

 

posted @ 2013-04-24 17:28  KoMiles  阅读(453)  评论(0编辑  收藏  举报