随机跳转

<script language=javascript>
i = parseInt(Math.random()*2)
switch(i) {
case 0:location.href='http://www.baidu.com';break;
case 1:location.href='http://www.google.com';break;
}
</script>

<%
file=server.mappath("url.txt") '网址列表路径
set fs=server.createobject("scripting.filesystemobject") 'fso读写组件
set txt=fs.opentextfile(file,1,true) '打开
if not txt.atendofstream then p=split(txt.readall, vbcrlf) '分割为数组

randomize '纯随机,不重复
response.redirect p(int((ubound(p) * rnd) + 1)-1) '在(1-数组最大上标)之间生成随机数,并跳转到该页
response.end '结束
%>

原文地址:https://www.cnblogs.com/94YY/p/5674868.html