[导入]通过简易的前台代码实现无限二级域名转向(来自无忧 biyuan老矣)
只要空间支持泛域名解析,无须服务端脚本语言和DNS,通过前台代码便可实现无限二级域名的构造:
<html>
<head>
<title>碧原网络免费二级域名</title>
<head>
</head>
<body>
<scrīpt language="Javascrīpt">
<!--
//全局变量
var cUrl = "http://www2.17389.com/" //当处理失败时跳转的站点或目录
var Url = "17389"; //顶级域名的关键字,这里是www.17389.com
var sUrl = location.href; //获取当前用户输入地址
var oUrl = ((sUrl.split(".")[0]).split("//")[1]); //对用户获取的地址进行分割
var xUrl = false; //创建一个全局变量,方便判断记录集是否存在
//用户信息
var User = new Array();
User[0] = new Array("biyuan","http://aoao.52ui.com/biyuan/","碧原在线");
User[1] = new Array("fhonline","http://www.17389.com","飞鸿网络");
User[2] = new Array("51js","http://www.51js.com/","无忧脚本");
User[3] = new Array("ucren","http://www.ucren.com/","游戏人");
User[4] = new Array("aoao","http://aoao.52ui.com/","无忧嗷嗷");
//判断顶级域名合法性
if (sUrl.split(".")[1] != Url){
location.href = cUrl;
}
//匹配数据,执行跳转
else {
for (var j=0;j < User.length;j++){
if (oUrl == User[j][0]){
document.write ("正在加载" + User[j][2] + ",请稍候...."); //跳转时显示的信息
document.title = User[j][2]; //跳转时标题栏的信息
xUrl = User[j][1]; //对全局变量进行赋值
setTimeout("location.href = xUrl",5000); //停留5秒后执行跳转
}
}
}
//记录不存在提示错误信息
if(!xUrl){
document.write("找不到该域名.停留10秒以后跳转到<a href='" + cUrl + "'>碧原网络</a>");
setTimeout("location.href = cUrl",10000);
}
//-->
</scrīpt>
</body>
</html>
文章来源:http://www.cnblogs.com/suiqirui19872005/archive/2007/05/15/747805.html