|
是不是有好幾個(gè)鏡像站點(diǎn)?是不是經(jīng)常有的站點(diǎn)打不開?你是不是想讓網(wǎng)友自動(dòng)進(jìn)入一個(gè)最快的鏡像站點(diǎn)?相信這是困擾了許多個(gè)人網(wǎng)站站長的問題,現(xiàn)在終于有了個(gè)很好的解決辦法了......
方案一:
<html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> <meta http-equiv="refresh" content="5;url=./"> //設(shè)定檢測的時(shí)間,每5秒刷新一次 <title>自動(dòng)選擇最快站點(diǎn)</title></head> <center> <p>
<font color=blue size=7> 請稍候,正在選擇速度最快站點(diǎn)......</p> <script> i=1 var autourl=new Array() autourl[1]="http://szyhbcn.y365.com"; autourl[2]="http://www.qxcomm.com/p_html/szyhbcn"; autourl[3]="http://free.yc365.com/szyhbcn"; //設(shè)置三個(gè)鏡像站點(diǎn),當(dāng)然你也可以多加幾個(gè)只要如上形式即可. function auto(url) //設(shè)置一個(gè)自動(dòng)轉(zhuǎn)向的函數(shù) { if(i) { i=0; top.location=url //設(shè)置新頁面打開的形式 }} function run() //設(shè)置一個(gè)啟動(dòng)函數(shù) { for(var i=1; i<autourl.length;i++) //設(shè)置一個(gè)循環(huán)檢測,檢測最先打開的站點(diǎn) document.write("<img src="+autourl+" width=1 height=1 onerror=auto('"+autourl+"')>") //寫出具體的鏈接地址 } run() //啟動(dòng)函數(shù) </script> </body></html>
方案二:
直接將下面代碼加入到<body></body>中
<script> i=1
var autourl=new Array()
autourl[1]="szyhbcn.y365.com"
autourl[2]="www.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>
|