访问很多网站的时候发现他们都喜欢在首页是列举出很多的镜象服务器地址让用户自己选择进入。如http://www.btbbt.com/ 等。
特别是中国,网通电信两大运营商相互限制对方的访问速度,让很多的网通用户打开电信的服务器慢,电信的用户访问网通的服务器也慢。
让用户自己选择不是很好的,很多用户觉得会很麻烦。那么如何像:Http://www.hidotnet.com/ 一样自动的分配最快的服务器给用户呢?
演示地址:http://www.maxer.cn/autourl.htm
请看如下代码:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>正在选择速度最快的镜像站点...</title></head>
<body>
<center><br><p> </p><p> </p>
<p><font color=red size=4><br><br></font><font color=red
size=2>请稍候,正在分配最快的镜像给您登陆...</p>
</font>
<font color=red size=4>
<script>
i=1
var autourl=new Array()
autourl[1]="http://1.com"
autourl[2]="http://2.com"
autourl[3]="http://3.com"
autourl[4]="http://4.com"
autourl[5]="http://5.com"
{
if(i){top.location=url;i=0}
}
function run()
{
for(var i=1;i<autourl.length;i++)
document.write("<img src="+autourl[i]+" width=1 height=1 onerror=choose('"+autourl[i]+"')>")
}
run()
</script>
</font>
</body>
This weblog is Power by Maxer.CN(刘翔).
文章来源:http://www.maxer.cn/blog/PermaLink,guid,2eb51966-c7b8-473a-a2e1-83275673ba27.aspx