金光 发表于 2006 年 10 月 13 日 21:54:55

线路分流自动跳转代码;希望对大家有用!

本人经过测试非常好用
代码一:
在要跳转的页面上写上:
<script language="JavaScript">
var m=50000;
var n=Math.floor(Math.random()*m+1)
//alert(n);
document.write("<iframesrc=http://cnc.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
document.write("<iframesrc=http://dx.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
document.write("<iframesrc=http://www.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
</script>

--------------------------------------------------------------------------------------
test.htm页面代码:注意每个服务器站点都要放这个文件:
<script language="JavaScript">
/*
这里写上一写文字,不要太多150-200行就可以了,主要作用是,如果你的站点默认页面为DEFAULT。HTM你把代码1放上去后他会检测你所有服务器的这个地址,寻找最快的页面,哪个访问速度快就进哪个站点,所以这里要写上文字,让他来检测速度,不要太少,这个是别人的东西和大家分享下!
*/

if (top.location !== self.location) {
top.location=self.location;
}
var url1,url2;
url1=location.search.replace(/\?/g,"")
url2=url1.split("||");
location.href="index.htm";
</script>
站点演示:http://www.5nd.com
       网通:http://cnc.5nd.com
大家测试看看是不是跳转到最快的服务器上!

帅气 发表于 2006 年 10 月 14 日 09:08:33

yanhua 发表于 2006 年 10 月 15 日 19:06:03

顶...........

hotboy 发表于 2006 年 10 月 15 日 21:02:08

好东东啊
正需要这个

黑色红色 发表于 2006 年 10 月 17 日 10:51:22

我寸起来了 以后应该会用到 呵呵

金光 发表于 2007 年 3 月 22 日 13:33:06

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML><HEAD><TITLE>金光论坛/金光免费/商业空间(资源)导航</TITLE>
<meta http-equiv='Content-Type' content="text/html; charset=gb2312">
<meta name="robots" content="金光免费/商业空间(资源)导航,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,绿色软件,金光论坛,Free Web Space,Free Web Hosting">
<META NAME="KEYWORDS" CONTENT="金光免费/商业空间(资源)导航,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,绿色软件,金光论坛,Free Web Space,Free Web Hosting" />
<META NAME="DESCRIPTION" CONTENT="金光免费空间(资源)导航,商业空间导航,免费空间,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,源码下载,软件下载,金光论坛" />
<LINK href="favicon.ico" rel="SHORTCUT ICON">
<style type=text/css>body{font-family:宋体}td{font-size:12px}.f14{font-size:14.8px}.ff{font-family:Verdana;font-size:16px}.s{text-decoration:none}.t{color:#0000cc;font-weight:normal;text-decoration:none}a.t:hover{text-decoration:underline}.m{color:#000000;cursor:hand;text-decoration:none}a.m:hover{text-decoration:underline}</style>
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
</HEAD>
<script type="text/javascript">
var cookieEnabled=(navigator.cookieEnabled)? true : false
//判断cookie是否开启

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

/*
检查此IE是否支持cookie

*/      
//document.cookie = 'killme' + escape('nothing')
function cc()
{
      if (document.cookie == "")
      {
                alert("请打开cookie选项");
                document.getElementById('message').style.display='';
                document.getElementById('setarea').style.display='none';
                window.setTimeout("goto();",3000)
                document.Form1.cookieexists.value ="false"
      }
      else
      {
                Get();
      alert("你已经打开了cookie选项!!!!!");
      document.getElementById('setarea').style.display='';               
      }
}


function GetCookie(name)
{
   var arg=name+ "=";
   var alen=arg.length;
   var clen=document.cookie.length;
   var i=0;
   while (i<clen) {
       var j=i+alen;
       if(document.cookie.substring(i,j)
       ==arg)
       return getCookieVal(j);
       i=document.cookie.indexOf("",i)+1;
       if(i==0)break;
   }
   return null;
}

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

function Get()
{                        
      if (cookieEnabled)
      {               
                var CookieArea = GetCookie('zz_area');
                //var CookieArea = "CNC";
                if (CookieArea == "CNC")
                {               
                        document.getElementById('loading').style.display='';                              
                        document.getElementById('setarea').style.display='none';                              
                        this.location = "http://bbs.jgfree.net/index.php";
                }
                else
                {
                        //判断电信线路
                        if (CookieArea == "TEL")
                        {
                              document.getElementById('loading').style.display='';                              
                              document.getElementById('setarea').style.display='none';                              
                              this.location = "http://bbs.jgwy.net/index.php";
                        }
                        //判断移动线路
                        if (CookieArea == "YD")
                        {
                              document.getElementById('loading').style.display='';                              
                              document.getElementById('setarea').style.display='none';                              
                              this.location = "http://www.jgwy.net/bbs/index.php";
                        }                              
                        else
                        {
                              document.getElementById('setarea').style.display='';
                        }
                }
      }
      else
      {               
                this.location = "http://jgwy.net/bbs/index.php";
      }
}
function SetCNC()
{
      var mydate = new Date();
      mydate.setTime(mydate.getTime() + 315360000000);
      document.cookie = "zz_area=CNC;expires="+ mydate.toGMTString() + ";domain=bkbbs.net";
      Get();
}
function SetTEL()
{
      var mydate = new Date();
      mydate.setTime(mydate.getTime() + 315360000000);
      document.cookie = "zz_area=TEL;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
      Get();
}
function SetYD()
{
      var mydate = new Date();
      mydate.setTime(mydate.getTime() + 315360000000);
      document.cookie = "zz_area=YD;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
      Get();
}
</script>

<BODY text=#000000 vLink=#0000cc aLink=#ff6600 link=#0000cc bgColor=#ffffff>
<CENTER><IMG height=110 src="images/slogo.gif" width=286 border=0><BR><IMG height=23 width=1><BR>
<TABLE cellSpacing=0 cellPadding=0 width=600 bgColor=#eeeeee border=0>
<TBODY><TR><TD width=56 height=18>&nbsp; ;</TD>
<TD class=m onmouseover="this.bgColor='#ffffff';"
onclick="g('http://bbs.jgfree.net')" onmouseout="this.bgColor='#eeeeee';"
vAlign=bottom align=middle width=67><A class=t
href="http://bbs.jgfree.net" target="_blank">论 坛</A></TD>
<TD class=s vAlign=bottom align=middle width=67 bgColor=#0033cc><FONT
color=#ffffff><B>首 页</B></FONT></TD>
<TD class=m onmouseover="this.bgColor='#ffffff';"
onclick="g('http://www.jgfree.net')" onmouseout="this.bgColor='#eeeeee';"
vAlign=bottom align=middle width=67><A class=t
href="http://www.jgfree.net/" target="_blank">免费站</A></TD>
<TD class=m onmouseover="this.bgColor='#ffffff';"
onclick="g('http://www.paidhost.net')" onmouseout="this.bgColor='#eeeeee';"
vAlign=bottom align=middle width=67><A class=t
href="http://www.paidhost.net/" target="_blank">商业站</A></TD>
<TD class=m onmouseover="this.bgColor='#ffffff';"
onclick="g('http://www.jgidc.com')" onmouseout="this.bgColor='#eeeeee';"
vAlign=bottom align=middle width=67><A class=t
href="http://www.jgidc.com/" target="_blank">国际站</A></TD>
<TD class=m onmouseover="this.bgColor='#ffffff';"
onclick="g('http://nbgh.cn')" onmouseout="this.bgColor='#eeeeee';"
vAlign=bottom align=middle width=67><A class=t
href="http://nbgh.cn" target="_blank">游戏站</A></TD>
<TD width=57>&nbsp; ;</TD></TR>
<TR><TD bgColor=#0033cc height=1></TD>
<TD bgColor=#0033cc colSpan=7></TD>
<TD bgColor=#0033cc></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=600 border=0>
<TBODY><TR><TD colSpan=5 height=18></TD></TR>
<TR><TD colSpan=5 height=26>&nbsp; ;</TD></TR></TBODY></TABLE>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>

                  <td width="1"></td>
                  <td>
<div id="message"align="center" style="display:none">
      由于你的浏览器没有开启COOKIE功能(建议打开),系统将在3秒钟后,自动引导到金光网络主服务器...
</div>
<div id="loading" align="center" style="display:none">
<br />
      正在装载,请稍候...
</div>      
<div id="setarea"align="center" style="display:none">
      <br />
      请您选择最快的站点,此选项将不会再次出现<br /> <br />

      如您希望重新选择,请清除浏览器COOKIE<br /><br />
          <br />
      <input type="button" value="中国移动" onClick="SetYD()">
      <input type="button" value="北方网通" onClick="SetCNC()">
      <input type="button" value="南方电信" onClick="SetTEL();">
      <input type="button" value="自动判断" onClick="javascript:window.location='auto.html'">
</div>

<br />
</td>
<td width="1"></td>
</tr>
</table>
</body>
</html>
<HTML><HEAD><TITLE>金光论坛/金光免费/商业空间(资源)导航</TITLE>
<meta http-equiv='Content-Type' content="text/html; charset=gb2312">
<meta name="robots" content="金光免费/商业空间(资源)导航,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,绿色软件,金光论坛,Free Web Space,Free Web Hosting">
<META NAME="KEYWORDS" CONTENT="金光免费/商业空间(资源)导航,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,绿色软件,金光论坛,Free Web Space,Free Web Hosting" />
<META NAME="DESCRIPTION" CONTENT="金光免费空间(资源)导航,商业空间导航,免费空间,网页制作,ASP/CGI/PHP/JSP代码交流,设计美化,服务器技术,源码下载,软件下载,金光论坛" />
<LINK href="favicon.ico" rel="SHORTCUT ICON">
<style type=text/css>body{font-family:宋体}td{font-size:12px}.f14{font-size:14.8px}.ff{font-family:Verdana;font-size:16px}.s{text-decoration:none}.t{color:#0000cc;font-weight:normal;text-decoration:none}a.t:hover{text-decoration:underline}.m{color:#000000;cursor:hand;text-decoration:none}a.m:hover{text-decoration:underline}</style>
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
</head>
<body>
<div>
<p>尊敬的朋友,您好!系统正在自动选择最快的网络访问金光论坛</p>

<p>速度测试中,请稍候……</p>

<script type="text/javascript">
    i=1
    var autourl=new Array()
    autourl="http://www.jgwy.net/bbs/index.php"
    autourl="http://bbs.jgwy.net/index.php"
    autourl="http://bbs.jgfree.net/index.php"
      
    function auto(url){
    if(i){i=0;top.location=url}
    }
    function run(){
    for(var i=1;i<autourl.length;i++)
   document.write("<img src='"+autourl+"' width=1 height=1 onerror=auto('"+autourl+"')>")
    }
    run()
</script>

<p><TABLE cellSpacing=0 cellPadding=0 width=600 border=0>
<TBODY><TR vAlign=top align=middle>
<TD class=t colSpan=3 height=30><A href="map.htm">金光大全</A></TD></TR>
<TR><TD></TD>
<TD class=t align=middle height=13><A href="http://www.jgwy.net/">
<SPAN style="CURSOR: hand" onclick="window.external.AddFavorite('http://www.jgwy.net/', '金光网')">加入收藏</SPAN></A> | <A onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.jgwy.net/');" href="#">设为首页</A> | <A href="mailto:deyima@nbip.net">联系我们</A> | <A href="http://www.jgwy.net/support.htm" target="_blank">广告投放</A></TD>
<TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=600 border=0><TBODY><TR>
<TD class=m align=middle height=30><FONT color=#7777cc>JgWy</FONT> <FONT
color=#7777cc>&copy;2001-2007</FONT>&nbsp; ;<a href="http://www.Jgwy.net/" target="_blank"><FONT
color=#7777cc>Jgwy.net</FONT></a> | <a href="http://www.Jgfree.net/" target="_blank"><FONT
color=#7777cc>Jgfree.net</FONT></a> | <a href="http://www.paidhost.net/" target="_blank"><FONT
color=#7777cc>Paidhost.net</FONT></a> | <a href="http://www.jgidc.com/" target="_blank"><FONT
color=#7777cc>JgIdc.Com</FONT></a>&nbsp; ;</TD></TR>
<tr><TD class=m align=middle height=30>
<a href="http://www.miibeian.gov.cn/" target="_blank"><FONT
color=#7777cc>浙ICP备05036471号</FONT></a></td></tr>
</TBODY></TABLE>
<p><script language="javascript" type="text/javascript" src="http://js.users.51.la/50533.js"></script>
</CENTER>
</div>
</body>
</html>

lide9527 发表于 2007 年 3 月 26 日 22:50:17

正需要这个东西,太谢谢你了,先试试看看怎么样

f 发表于 2007 年 3 月 27 日 08:39:59

:) :) :) :) 自动选择,自动的!
页: [1]
查看完整版本: 线路分流自动跳转代码;希望对大家有用!