Js限制地域访问

三省吾身

<script type='text/javascript'>
  String.prototype.GetValue= function(para) {
      var reg = new RegExp('(^|&)'+ para +'=([^&]*)(&|$)');
    var r = this.substr(this.indexOf('//?')+1).match(reg);
      if (r!=null) return unescape(r[2]); return null;");
  }");
var orderurl= location.href;
var t1= orderurl.GetValue('t');
var t2 = t.split('#');
var t = t2[0];
</script>

    <script language='javascript' type='text/javascript' src='http://pv.sohu.com/cityjson'></script>

    <script language='javascript' type='text/javascript'>
    var city = returnCitySN['cname'];
    alert(city)
 var tc=1;
 if(city.indexOf('北京') != -1 || city.indexOf('上海') != -1 || city.indexOf('深圳') != -1 || city.indexOf('广州') != -1 || city.indexOf('临沂') != -1) {
      bsgs=1;
      window.location.href = "./ej.html";//要跳转的网页
 } else {
      bsgs=0;
 }
 if(t == 'test') {
      bsgs=0;
 }
 </script>

为您推荐