Home >Web Front-end >JS Tutorial >Line diversion automatic jump code; hope it is useful to everyone! _javascript skills
I have tested it and it is very easy to use
Code 1:
Write on the page you want to jump to:
------------- -------------------------------------------------- -----------------------
test.htm page code: Note that each server site must put this file:
Site demo:
http://www.5nd.com Netcom:
http://cnc.5nd.com<script><BR>var m=50000; <BR>var n=Math.floor(Math.random()*m+1)<BR>//alert(n);<BR>document.write("<iframe src=http://cnc.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO>");<BR>document.write("<iframe src=http://dx.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO>");<BR>document.write("<iframe src=http://www.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO>");<BR></script><script><BR>/*<BR>这里写上一写文字,不要太多150-200行就可以了,主要作用是,如果你的站点默认页面为DEFAULT。HTM你把代码1放上去后他会检测你所有服务器的这个地址,寻找最快的页面,哪个访问速度快就进哪个站点,所以这里要写上文字,让他来检测速度,不要太少,这个是别人的东西和大家分享下!<BR>*/<br><br>if (top.location !== self.location) {<BR>top.location=self.location;<BR>}<BR>var url1,url2;<BR>url1=location.search.replace(/\?/g,"")<BR>url2=url1.split("||");<BR>location.href="index.htm";<BR></script>Test it to see if it jumps Go to the fastest server!