当前位置:编程学习 > JS >>

Javascript根据用户浏览信息判断是否为国内外IP

网页特效根据用户浏览信息判断是否为国内外ip

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" language="javascript">
  var browser_agent = navigator.useragent;
    //Ϊie
    if(browser_agent.indexof("msie")!=-1){
        var a=navigator.browserlanguage;
        if(a !="zh-cn"){
            location.href="中文";
   document.write("ip");
        } else
   document.write("ip");
    }
    //ie
    else{
        var b=navigator.language;
        if(b!="zh-cn"){
            location.href="国外ip";
   document.write("ip");
        } else
   document.write("ip");
    }

</script>

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,