网上找到这一段检测浏览器的代码:
var Browser = { isIE:navigator.userAgent.indexOf("MSIE")>-1 && !window.opera, isGecko:navigator.userAgent.indexOf("Gecko")>-1 && !window.opera && navigator.userAgent.indexOf("KHTML") ==-1, isKHTML:navigator.userAgent.indexOf("KHTML")>-1, isOpera:navigator.userAgent.indexOf("Opera")>-1 }; 但看不懂怎么使用?想得到以下效果:<SCRIPT type=text/javascript>
if(){
 document.write("你当前使用的是firefox浏览器,部份功能不能使用");
}else{
 document.write("你当前浏览器支持本网站所有功能");
}
</SCRIPT>请高手给出效代码,直接复制可用,谢谢!

解决方案 »

  1.   

    我这有一段代码,不知道能不能帮你function CheckBrowse()
    {
    if(navigator.appName!="Microsoft Internet Explorer")
    alert("");

    if(navigator.appVersion.indexOf("MSIE 7.0")+navigator.appVersion.indexOf("MSIE 6.0")<0)
    alert("");
    }
      

  2.   

    if(navigator.userAgent.indexOf("Firefox")>0){
     document.write("你当前使用的是firefox浏览器,部份功能不能使用");
    }else{
    document.write("你当前浏览器支持本网站所有功能");
    }
    一般用userAgent检测客户端的
      

  3.   

    可使用navigator对象中的属性进行检测
      

  4.   


    function testIExplorer(){
    var Sys = {}; 
    var ua = navigator.userAgent.toLowerCase();
    var b=false;
    if(ua.indexOf("maxthon/3.0")!=-1){
    b=true;
    }else{
    if (window.ActiveXObject){
    Sys.ie = ua.match(/msie ([\d.]+)/)[1];
    }else if (document.getBoxObjectFor){
    Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1];
    }else if (window.MessageEvent && !document.getBoxObjectFor){
    Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1];
    }else if (window.opera){
    Sys.opera = ua.match(/opera.([\d.]+)/)[1];
    }else if (window.openDatabase){
    Sys.safari = ua.match(/version\/([\d.]+)/)[1]; 
    }
    //以下进行测试 
    if(!Sys.ie){
    b=true;
    }
    }
    var re="";
    if(b){
    re="other";
    }else{
    re="IE"+String(Sys.ie);
    if(re.indexOf(".")!=-1){
    re=re.substring(0,re.indexOf("."));
    }
    }
    return re;
    }
    这是我一个WEB项目中用的,比较顺手
      

  5.   


    日前只发现火狐上不兼容,当然最好能有各种IE结论,方便以后发现可以调整,如:<SCRIPT type=text/javascript>
    if(){
     document.write("你当前使用的是firefox浏览器,部份功能不能使用");
    }else if(){
     document.write("你当前使用的是腾讯浏览器,部份功能不能使用");
    }else{
     document.write("你当前浏览器支持本网站所有功能");
    }
    </SCRIPT>
      

  6.   

    Browser.isIE
    就这么使用 ,其实你可以根据你的要求改改就行了 。
      

  7.   

    怎么得到这样的效果:
    if(){
     document.write("你当前使用的是firefox浏览器,部份功能不能使用");
    }else{
     document.write("你当前浏览器支持本网站所有功能");
    }