找回密码
 注册
广告投放 虚位以待【阿里云】2核2G云新老同享 99元/年,续费同价做网站就用糖果主机-sugarhosts.comJtti.com-新加坡服务器,美国服务器,香港服务器
查看: 460|回复: 0

电信网通自动跳转的代码

[复制链接]
发表于 2010 年 10 月 1 日 15:21:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
js一:
  1. <script type="text/javascript">
  2. var cookieEnabled=(navigator.cookieEnabled)? true : false
  3. //判断cookie是否开启

  4. //如果浏览器不是ie4+或ns6+
  5. if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){
  6. document.cookie="testcookie"
  7. cookieEnabled=(document.cookie=="testcookie")? true : false
  8. document.cookie="" //erase dummy value
  9. }

  10. /*
  11. 检查此IE是否支持cookie

  12. */        
  13. //document.cookie = 'killme' + escape('nothing')
  14. function cc()
  15. {
  16.          if (document.cookie == "")
  17.          {
  18.                  alert("请打开cookie选项");
  19.                  document.getElementById('message').style.display='';
  20.                  document.getElementById('setarea').style.display='none';
  21.                  window.setTimeout("goto();",3000)  
  22.                  document.Form1.cookieexists.value ="false"
  23.          }
  24.          else
  25.          {
  26.                  Get();
  27.          alert("你已经打开了cookie选项!!!!!");
  28.          document.getElementById('setarea').style.display='';               
  29.          }
  30. }


  31. function GetCookie(name)
  32. {
  33.       var arg=name+ "=";
  34.       var alen=arg.length;
  35.       var clen=document.cookie.length;
  36.       var i=0;
  37.       while (i<clen) {
  38.         var j=i+alen;
  39.         if(document.cookie.substring(i,j)
  40.         ==arg)
  41.         return getCookieVal(j);
  42.         i=document.cookie.indexOf("",i)+1;
  43.         if(i==0)break;
  44.       }
  45.       return null;
  46. }

  47. function getCookieVal(offset) {
  48.       var endstr=document.cookie.indexOf
  49.         (";",offset);
  50.       if(endstr==-1) //没有指定其他元素
  51.         endstr=document.cookie.length;
  52.       return unescape(document.cookie.substring
  53.         (offset,endstr));
  54.     }

  55. function Get()
  56. {                        
  57.          if (cookieEnabled)
  58.          {               
  59.                  var CookieArea = GetCookie('zz_area');
  60.                  //var CookieArea = "CNC";
  61.                  if (CookieArea == "CNC")
  62.                  {               
  63.                          document.getElementById('loading').style.display='';                                
  64.                          document.getElementById('setarea').style.display='none';                                
  65.                          this.location = "http://bbs.jgfree.net/index.php";
  66.                  }
  67.                  else
  68.                  {
  69.                          //判断电信线路
  70.                          if (CookieArea == "TEL")
  71.                          {
  72.                                  document.getElementById('loading').style.display='';                                
  73.                                  document.getElementById('setarea').style.display='none';                                
  74.                                  this.location = "http://bbs.jgwy.net/index.php";
  75.                          }
  76.                          //判断移动线路
  77.                          if (CookieArea == "YD")
  78.                          {
  79.                                  document.getElementById('loading').style.display='';                                
  80.                                  document.getElementById('setarea').style.display='none';                                
  81.                                  this.location = "http://www.jgwy.net/bbs/index.php";
  82.                          }                                
  83.                          else
  84.                          {
  85.                                  document.getElementById('setarea').style.display='';
  86.                          }
  87.                  }
  88.          }
  89.          else
  90.          {               
  91.                  this.location = "http://jgwy.net/bbs/index.php";
  92.          }
  93. }
  94. function SetCNC()
  95. {
  96.          var mydate = new Date();
  97.          mydate.setTime(mydate.getTime() + 315360000000);
  98.          document.cookie = "zz_area=CNC;expires="+ mydate.toGMTString() + ";domain=bkbbs.net";
  99.          Get();
  100. }
  101. function SetTEL()
  102. {
  103.          var mydate = new Date();
  104.          mydate.setTime(mydate.getTime() + 315360000000);
  105.          document.cookie = "zz_area=TEL;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
  106.          Get();
  107. }
  108. function SetYD()
  109. {
  110.          var mydate = new Date();
  111.          mydate.setTime(mydate.getTime() + 315360000000);
  112.          document.cookie = "zz_area=YD;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
  113.          Get();
  114. }
  115. </script>
复制代码



js二:
  1. <script type="text/javascript">
  2. i=1
  3. var autourl=new Array()
  4. autourl[1]="http://www.jgwy.net/bbs/index.php"
  5. autourl[2]="http://bbs.jgwy.net/index.php"
  6. autourl[3]="http://bbs.jgfree.net/index.php"

  7. function auto(url){
  8. if(i){i=0;top.location=url}
  9. }
  10. function run(){
  11. for(var i=1;i<autourl.length;i++)  
  12. document.write("<img src='"+autourl[i]+"' width=1 height=1 onerror=auto('"+autourl[i]+"')>")
  13. }
  14. run()
  15. </script>
复制代码


【这个要简单些,是通过加载速度来判断最快的镜像】

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
  3. <head>
  4. <title>jump</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta http-equiv="refresh" content="30; url=*.htm" />

  7. <script language=JavaScript>
  8. var i = 1;<!--
  9. if (top.location != location) top.location.href = location.href;
  10. self.moveTo(0,0);
  11. self.resizeTo(screen.availWidth,screen.availHeight);
  12. // -->
  13. </script>

  14. </head>

  15. <body>

  16. <noscript><iframe src=*.htm></iframe></noscript>

  17. <script language="javascript">
  18. if (top.location != location)
  19. top.location.href = self.location;
  20. </script>

  21. <div>
  22. <p>正在选择速度最快镜像...</p>
  23. <p>长时间没有响应请选择以下入口点击进入</p>
  24. <ul>
  25. <li><a href="http://bbs.jgfree.net/index.php">网通</a></li>
  26. <li><a href="http://bbs.jgwy.net/index.php">电信</a></p></li>
  27. </ul>
  28. </div>

  29. <script>
  30. i=1
  31. var autourl=new Array()
  32. autourl[1]="http://bbs.jgfree.net/index.php"
  33. autourl[2]="http://www.jgwy.net/bbs/index.php"
  34. function auto(url){if(i){i=0;top.location=url}}
  35. function run(){for(var i=1;i<autourl.length;i++)document.write("<img src="+autourl[i]+" width=1 height=1 onerror=auto('"+autourl[i]+"') />")}
  36. run()
  37. </script>

  38. </body>
  39. </html>
复制代码




Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2025 年 2 月 3 日 21:05 , Processed in 0.026971 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表