1. var isIE = !!window.ActiveXObject;  
  2. var isIE6 = isIE && !window.XMLHttpRequest;  
  3. var isIE8 = isIE && !!document.documentMode;  
  4. var isIE7 = isIE && !isIE6 && !isIE8; 

 

 

 


var isIE = navigator.userAgent.indexOf('MSIE') != -1;
var isIE6 = navigator.userAgent.indexOf('MSIE 6.0') != -1;
var isIE8 = !!window.XDomainRequest && !!document.documentMode;

 

 

 

 

 

 

 

 

<script language="javascript">
    if(window.XMLHttpRequest)//判断浏览器是否属于Mozilla,Sofari
    {
        alert("firefox");
    }
    else if(window.ActiveXObject)//判断浏览器是否属于IE
    {
        var browser=navigator.appName 
        var b_version=navigator.appVersion 
        var version=b_version.split(";"); 
        var trim_Version=version[1].replace(/[ ]/g,""); 
        if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
        { 
        alert("IE 7.0"); 
        } 
        else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
        { 
        alert("IE 6.0"); 
        } 
    }

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2021-07-30
  • 2021-12-11
猜你喜欢
  • 2022-02-15
  • 2022-02-01
  • 2021-05-21
  • 2022-12-23
  • 2021-12-05
  • 2021-12-27
  • 2022-02-11
相关资源
相似解决方案