5秒倒数跳转页面

yoloV 2012-04-21 10:49:26
<body>
<h1 align="center">插入成功</h1>
<h3 align="center"id="p1"></h3>
<script language="vbscript">
i = 5
sub a()
do while i>0
p1.InnerHtml =""
S = i&"秒后自动跳转<a href='管理员名单.asp'>管理员名单</a>页面"
p1.InnerHtml = S
i = i-1
document.write i
loop
//SetTimeOut "a()",1000
end sub
a()
//SetTimeOut "a()",1000
</script>
</body>


这个思路有问题吗 每次都输出是循环最后一个
难道不能用循环吗?


结果怎么写成动态的。
...全文
276 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
小伙真帅 2012-04-23
  • 打赏
  • 举报
回复
貌似楼上都已经写过了。哈哈。。。
小伙真帅 2012-04-23
  • 打赏
  • 举报
回复
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<h1 align="center">插入成功</h1>
<h3 align="center" id="p1"><span id=timer>5</span>秒后自动跳转<a href='管理员名单.asp'>管理员名单</a>页面</h3>
<script>
function Timer(){
var TimeSpan = document.getElementById("timer");
TimeSpan.innerHTML = parseInt(TimeSpan.innerHTML) -1 //自动给他减1秒
if(TimeSpan.innerHTML ==0){
//如果是0秒了。
location.href='http://www.baidu.com';

}

}

setInterval("Timer()",1000)
</script>
</body>
</html>


Dogfish 2012-04-23
  • 打赏
  • 举报
回复
javascript, setInterval来实现。可以实现多点的动作。
文盲老顾 2012-04-22
  • 打赏
  • 举报
回复
4 楼正解
hnfz123 2012-04-22
  • 打赏
  • 举报
回复
<meta http-equiv="refresh" content="5; url=xxx.asp">
这个还是比较有效的
rayyu1989 2012-04-22
  • 打赏
  • 举报
回复

<div id="msg"></msg>
<script type="text/javascript">
var times=10;
function test(){
document.getElementById("msg").innerHTML="页面将在"+times+"后跳转";
times-=1;
if(times<=0){
window.clearInterval(doTEST);
window.location.href="http://www.370b.com";
}
}
var doTEST;
window.clearInterval(doTEST);
doTEST=window.setInterval("test()",1000);
</script>
http://rayyu.5d6d.com/viewthread.php?tid=9046&highlight=%B5%B9%BC%C6%CA%B1
chate 2012-04-22
  • 打赏
  • 举报
回复
<meta http-equiv="refresh" content="5; url=管理员名单.asp">
001007009 2012-04-21
  • 打赏
  • 举报
回复
vbscript 只能在ie下运行。
用js来写

<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<h1 align="center">插入成功</h1>
<h3 align="center" id="p1"><span>5</span>秒后自动跳转<a href='管理员名单.asp'>管理员名单</a>页面</h3>
<script>
var $ = function(id){
return document.getElementById(id);
};
var $t = function(tag, cot){
cot = cot || document;
return cot.getElementsByTagName(tag);
};
var o = $t('span', $('p1'))[0];
var timer = setInterval(function(){
if(+o.innerHTML > 1){
o.innerHTML -= 1;
}else{
clearInterval(timer);
location.href = 'http://www.baidu.com/';
}
}, 1000)
</script>
</body>
</html>

yoloV 2012-04-21
  • 打赏
  • 举报
回复
<body>
<h1 align="center">插入成功</h1>
<h3 align="center"id="p1">
<script language="vbscript">
i = 5
sub a()
i = i-1
p1.InnerHtml = i
//SetTimeOut "a()",1000
end sub
a()
SetTimeOut "a()",1000
</script>秒后自动跳转<a href='管理员名单.asp'>管理员名单</a>页面</h3>
</body>

刚改的。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧