电信网通自动跳转的代码
js一:<script type="text/javascript">
var cookieEnabled=(navigator.cookieEnabled)? true : false
//判断cookie是否开启
//如果浏览器不是ie4+或ns6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){
document.cookie="testcookie"
cookieEnabled=(document.cookie=="testcookie")? true : false
document.cookie="" //erase dummy value
}
/*
检查此IE是否支持cookie
*/
//document.cookie = 'killme' + escape('nothing')
function cc()
{
if (document.cookie == "")
{
alert("请打开cookie选项");
document.getElementById('message').style.display='';
document.getElementById('setarea').style.display='none';
window.setTimeout("goto();",3000)
document.Form1.cookieexists.value ="false"
}
else
{
Get();
alert("你已经打开了cookie选项!!!!!");
document.getElementById('setarea').style.display='';
}
}
function GetCookie(name)
{
var arg=name+ "=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen) {
var j=i+alen;
if(document.cookie.substring(i,j)
==arg)
return getCookieVal(j);
i=document.cookie.indexOf("",i)+1;
if(i==0)break;
}
return null;
}
function getCookieVal(offset) {
var endstr=document.cookie.indexOf
(";",offset);
if(endstr==-1) //没有指定其他元素
endstr=document.cookie.length;
return unescape(document.cookie.substring
(offset,endstr));
}
function Get()
{
if (cookieEnabled)
{
var CookieArea = GetCookie('zz_area');
//var CookieArea = "CNC";
if (CookieArea == "CNC")
{
document.getElementById('loading').style.display='';
document.getElementById('setarea').style.display='none';
this.location = "http://bbs.jgfree.net/index.php";
}
else
{
//判断电信线路
if (CookieArea == "TEL")
{
document.getElementById('loading').style.display='';
document.getElementById('setarea').style.display='none';
this.location = "http://bbs.jgwy.net/index.php";
}
//判断移动线路
if (CookieArea == "YD")
{
document.getElementById('loading').style.display='';
document.getElementById('setarea').style.display='none';
this.location = "http://www.jgwy.net/bbs/index.php";
}
else
{
document.getElementById('setarea').style.display='';
}
}
}
else
{
this.location = "http://jgwy.net/bbs/index.php";
}
}
function SetCNC()
{
var mydate = new Date();
mydate.setTime(mydate.getTime() + 315360000000);
document.cookie = "zz_area=CNC;expires="+ mydate.toGMTString() + ";domain=bkbbs.net";
Get();
}
function SetTEL()
{
var mydate = new Date();
mydate.setTime(mydate.getTime() + 315360000000);
document.cookie = "zz_area=TEL;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
Get();
}
function SetYD()
{
var mydate = new Date();
mydate.setTime(mydate.getTime() + 315360000000);
document.cookie = "zz_area=YD;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
Get();
}
</script>
js二:
<script type="text/javascript">
i=1
var autourl=new Array()
autourl="http://www.jgwy.net/bbs/index.php"
autourl="http://bbs.jgwy.net/index.php"
autourl="http://bbs.jgfree.net/index.php"
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+"' width=1 height=1 onerror=auto('"+autourl+"')>")
}
run()
</script>
【这个要简单些,是通过加载速度来判断最快的镜像】
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>jump</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="30; url=*.htm" />
<script language=JavaScript>
var i = 1;<!--
if (top.location != location) top.location.href = location.href;
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);
// -->
</script>
</head>
<body>
<noscript><iframe src=*.htm></iframe></noscript>
<script language="javascript">
if (top.location != location)
top.location.href = self.location;
</script>
<div>
<p>正在选择速度最快镜像...</p>
<p>长时间没有响应请选择以下入口点击进入</p>
<ul>
<li><a href="http://bbs.jgfree.net/index.php">网通</a></li>
<li><a href="http://bbs.jgwy.net/index.php">电信</a></p></li>
</ul>
</div>
<script>
i=1
var autourl=new Array()
autourl="http://bbs.jgfree.net/index.php"
autourl="http://www.jgwy.net/bbs/index.php"
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+" width=1 height=1 onerror=auto('"+autourl+"') />")}
run()
</script>
</body>
</html>
页:
[1]