zoukankan      html  css  js  c++  java
  • 网站实现特定某个地区访问执行跳转(js方法)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    <Script type="text/javascript">
    document.write('<script type="text/javascript">var remote_ip_info={};</scrip' + 't>');
    document.write('<script type=text/javascript src=http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js></scrip' + 't>');
    var titlec;
    
    $(function(){
    getIP();
    var timer = setTimeout('getIP()',10);
    
    });
    function getIP() {
      var City = remote_ip_info;
      var p=City["province"]; //获取省
      var c=City["city"]; //获取市
      titlec=document.title;
      //alert(p+c);
      if(typeof(p)=='undefined'){
            timer = setTimeout('getIP()',50); 
      }else{
            if(p.search('河北')>-1){
              var gourl="http://www.baidu.com";
            location.replace(gourl);
          }else{
              var tc=clearTimeout(1000);
          }
      }
    }
    
    
    //加入以上代码,河北地区的用户访问你的网站会跳转到百度
    
    </Script>
    <body>
    </body>
    </html>
  • 相关阅读:
    断点调试
    内部类
    继承2
    继承
    构造函数
    方法
    二维数组
    HTML 一
    使用mySQL与数据库进行交互(一)
    使用mySQL与数据库进行交互(二)
  • 原文地址:https://www.cnblogs.com/txxt/p/5698381.html
Copyright © 2011-2022 走看看