通过js判断浏览器所用的操作系统的版本不同,进入不同的页面。比如英文操作系统进入英文页面,中文操作系统进入中文页面。网上找的
<script language=”JavaScript”>
var SysLan = window.navigator.systemLanguage; //取得浏览器版本语言
if(SysLan == "zh-cn")window.location = "index.php?id=191" //中文页面
if(SysLan == "en-us")window.location = "index.php?id=471" //英文页面
</script>不管用啊有没有更好的代码?谢谢大家

解决方案 »

  1.   

    function getLang(callback) { 
    //debugger; 
    var node = document.createElement("script"); 
    if (node.addEventListener) { 
        node.addEventListener("load", callback, false); 

    else { 
    node.onreadystatechange = function() { 
    if (this.readyState == "loaded") 
    callback.call(this); 

    }
    var wn=window.navigator;
    if (wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") { 
    node.type = "text/javascript"; 
    node.src = "http://counter.csdn.net/a/js/AreaCounter.js"; 

    else if (wn.systemLanguage=="zh-tw" || wn.language=="zh-TW") { 
    node.type = "text/javascript";
    node.src = "http://counter.csdn.net/a/js/AreaCounter.js"; 
    alert('tw');

    else if (wn.systemLanguage=="en" || wn.language=="zh-EN") { 
    alert('en');
    node.src = "http://counter.csdn.net/a/js/AreaCounter.js"; 

    document.getElementsByTagName("head").item(0).appendChild(node); 
    node = null; 
     

      

  2.   


    var SysLan = window.navigator.systemLanguage;
    if(SysLan == "zh-cn")window.location = "http://www.baidu.com";
    if(SysLan == "en-us")window.location = "index.php?id=471"; 
    // JS代码是没问题的
    你的location路径不对  应该是绝对路径
      

  3.   

    var wn=window.navigator;
    if (wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") { 
    window.location.href = "index.php?id=191";
    }else if (wn.systemLanguage=="en" || wn.language=="zh-EN") { 
    window.location.href = "index.php?id=471";
    } else{
    window.location.href = "index.php?id=191";//默认中文页面
    }
     
      

  4.   

    IE下用systemLanguage,FF下用language来获取当前语言.
      

  5.   

    Request.ServerVariables("http_accept_language")
      

  6.   

    楼主可以在不同的浏览器下运行以下脚本看看结果:
    <script type="text/javascript">
    document.write(navigator.browserLanguage+'<br>');
    document.write(navigator.platform+'<br>');
    document.write(navigator.cookieEnabled+'<br>');
    document.write(navigator.cpuClass+'<br>');
    document.write(navigator.onLine+'<br>');
    document.write(navigator.platform+'<br>');
    document.write(navigator.systemLanguage+'<br>');
    document.write(navigator.userAgent+'<br>');
    </script>
      

  7.   


    <script>
    var wn=window.navigator;
    if (wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") { 
    window.location = "http://www.zhongda.com/index.php?id=191"; 

    if (wn.systemLanguage=="en" || wn.language=="zh-EN") { window.location = "http://www.zhongda.com/index.php?id=471"; 
    } </script>
    为什么通过这个判断浏览器的语言不同跳到不同的页面,页面会一直刷新?
      

  8.   


    <script>
    var wn=window.navigator;
    var b = false;
    if (wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") { 
    b=true;
    window.location = "http://www.zhongda.com/index.php?id=191"; 
    break;

    if (wn.systemLanguage=="en" || wn.language=="zh-EN") { 
    b=true;
    window.location = "http://www.zhongda.com/index.php?id=471"; 
    break;

     </script>
    谢谢楼上的。这样还是不可以。:9
      

  9.   

    你这样,刷新还不是fasle了var wn=window.navigator;
    var href=location.href;
    if ((wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") && href.indexOf("id=191")==-1) { 
    window.location = "http://www.zhongda.com/index.php?id=191"; 

    else if ((wn.systemLanguage=="en" || wn.language=="zh-EN") && href.indexOf("id=471")==-1) {
        window.location = "http://www.zhongda.com/index.php?id=471"; 
    }