实现多镜像自动选择
作者: chill 日期: 2005-08-23 14:39
现在,很多朋友都申请了N个免费空间备用,然而多少subdomain的空间的域名记起来不方便,不利于网站推广。而网上的html实现多镜像自动选择的代码又或多或少有错,很多都调试不通过,例如这段代码:
就是错误的,而这却是许多网站给出的实例代码,下面来看我的:
(出自快手:java)
<html><head><title>自动打开最快镜像站的代码</title></head><body><script>
i=1
var autourl=new Array()
autourl[1]="szyhbcn.y365.com"
autourl[2]="qxcomm.com/p_html/szyhbcn"
autourl[3]="free.yc365.com/szyhbcn"
function auto(url){if(i){i=0;top.location=url}}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+" width=1 height=1 onerror=auto("http://"+autourl+"")>")}
run()
</script></body></html>
i=1
var autourl=new Array()
autourl[1]="szyhbcn.y365.com"
autourl[2]="qxcomm.com/p_html/szyhbcn"
autourl[3]="free.yc365.com/szyhbcn"
function auto(url){if(i){i=0;top.location=url}}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+" width=1 height=1 onerror=auto("http://"+autourl+"")>")}
run()
</script></body></html>
就是错误的,而这却是许多网站给出的实例代码,下面来看我的:
<html><head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<meta http-equiv="refresh" content="10;url=./"><title>速度测试中……</title></head><center>
<p>
<font color=blue size=7>
请稍候,速度测试中……</p><script>i=1
var autourl=new Array()
autourl[1]="http://www.cnfree.net/bbs"
autourl[2]="http://www.im286.com" //这里可以按格式加上autourl3....
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[i]+" width=1 height=1 onerror=auto(""+autourl[i]+"")>")}
run()</script></body></html>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<meta http-equiv="refresh" content="10;url=./"><title>速度测试中……</title></head><center>
<p>
<font color=blue size=7>
请稍候,速度测试中……</p><script>i=1
var autourl=new Array()
autourl[1]="http://www.cnfree.net/bbs"
autourl[2]="http://www.im286.com" //这里可以按格式加上autourl3....
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[i]+" width=1 height=1 onerror=auto(""+autourl[i]+"")>")}
run()</script></body></html>
(出自快手:java)
加入网摘
发表评论
订阅
上一篇
返回
下一篇

