用代码判断本地ADSL线路来选择访问网站的线路
1.首先分别解析电信和网通ip,如:www.1meter.cn解析到电信ip,cnc.1meter.cn解析到网通ip
2.新建index.html文件放到网站根目录下,完整代码如下:
<html>
<head>
<Script Langage=Javascript>
i=1
var autourl=new Array()
autourl[1]="http://www.1meter.cn/blog/"
autourl[2]="http://cnc.1meter.cn/blog/"
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>
<meta http-equiv="description" content="一米设计">
<meta http-equiv="keywords" content="一米设计">
<title>一米设计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</body>
<style type="text/css">
<!--
.STYLE1 {
color: #FF0000;
font-size: 14px;
font-weight: bold;
}
-->
</style>
<table width="500" border="0" align="center">
<tr>
<td><p align="center" class="STYLE1">本网站采用双线路系统,正在为您选择最快服务器路线,请稍等...
</td>
</tr>
</table>
</html>
注:把红色部分的域名改成你自己的即可
autourl[1]="http://www.1meter.cn/blog/"
autourl[2]="http://cnc.1meter.cn/blog/"
Recent Comments