随机跳转
2016-07-15 21:52
513 查看
<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 '结束
%>
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 '结束
%>
相关文章推荐
- 唯有一款软件,能用盗版的我坚决不用正版
- RxJava学习笔记
- Intent 显示与隐式
- cf 697 A
- C++遍历文件
- JQuery trigger 个人理解手记
- 什么是对象关系映射ORM?
- Android的活动周期
- uglifyjs压缩JS的
- C++捕获cin输入错误类型值的问题
- XCode 7 iOS 9 app submission failed.
- overflow:hidden
- hash_map原理
- JS面试题-动态生成表格代码
- C++中Mat类型与CSV、xml文件的存取转换
- 使用Maven运行Java main的3种方式
- mysql的两阶段提交协议
- angularJs+MVC+C#学习(二)
- cf 697 B(模拟)
- 集训总结day1