实现多镜像自动选择

现在,很多朋友都申请了N个免费空间备用,然而多少subdomain的空间的域名记起来不方便,不利于网站推广。而网上的html实现多镜像自动选择的代码又或多或少有错,很多都调试不通过,例如这段代码:
<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>

就是错误的,而这却是许多网站给出的实例代码,下面来看我的:
<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>


(出自快手:java)
引用通告地址: 点击获取引用地址
评论: 0 | 引用: 0 | 阅读: 620 | 打印
 加入网摘
发表评论
昵 称(*): 密 码:
网 址: 邮 箱:
验证码(*): 验证码图片 选 项:
头 像:
内 容(*):