怎么用ASP语句写一个3,2,1的倒计时?
我做了一个3秒钟后自动跳转的网面,不过我还想加入一句提示句,比方说"3秒钟后自动跳转页面",那个3在一秒钟后变成2,再一秒钟后变成1,怎么做?我只要3.2.1的倒数语句,...
我做了一个3秒钟后自动跳转的网面,不过我还想加入一句提示句,比方说"3秒钟后自动跳转页面",那个3在一秒钟后变成2,再一秒钟后变成1,怎么做?我只要3.2.1的倒数语句,请高手帮忙!
不要长篇大论,更不要随便复制别人的代码,就算复制,先看懂别人的代码再说,我要ASP的语句,看到我的问题,只要到计时3.2.1,请不要牛头不对马嘴,谢谢! 展开
不要长篇大论,更不要随便复制别人的代码,就算复制,先看懂别人的代码再说,我要ASP的语句,看到我的问题,只要到计时3.2.1,请不要牛头不对马嘴,谢谢! 展开
2个回答
展开全部
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
BODY { FONT-SIZE:12px; MARGIN:auto; FONT-FAMILY:tahoma, Verdana, Arial, Helvetica, sans-serif, "宋体"; }
A { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:link { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:visited { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:hover { COLOR:#a92400; FONT-SIZE:12px; TEXT-DECORATION:underline }
A:active { TEXT-DECORATION:none }
#Error1 { width:488px; margin:86px auto 0 auto; padding:2px; background:#FAFAFA; border:1px solid #F1F1F1; overflow:hidden; height:1% }
#Error1 .kuan { padding:1px; background:#EFFFD0; border:1px solid #E0E9F1 }
#Error1 .kuan span { font:normal 12px Arial; color:#666; padding:14px 0 10px 50px; margin:5px 20px 0 40px;}
#Error1 .kuan h3 { font:bold 14px Arial; color:#666; border-bottom:1px dashed #CCCCCC; height:36px; padding:5px 0 0 50px; margin:5px 20px 0 40px; background:url(icon_info.gif) no-repeat top left }
.btn { background:#d9d9d9; border-width:1px; vertical-align:middle; height:21px; padding-left:0.15em; padding-right:0.15em; border:1px solid; border-color:#c0c0c0 #555 #555 #c0c0c0; margin-bottom:3px }
</style>
<title>提示信息</title>
</head>
<body onload="s();">
<div id="Error1">
<table align="center" border="0" cellpadding="5" cellspacing="0" class="kuan" width="100%">
<tr>
<td><h3>系统提示您:</h3></td>
</tr>
<tr>
<td><span>操作成功!系统会在<span id="secondvalue">5</span>秒后跳转。<meta http-equiv=refresh Content='5;URL=cssTest.html'></span></td>
</tr>
<tr>
<td><span><a href="cssTest.html">如果没有跳转,请点这里...</a></span></td>
</tr>
</table>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
<!--
//获取表单中的表单域
var txt=document.getElementById("secondvalue");
//定义定时器的id
var id;
function s()
{
id = window.setInterval("tip()",1000);
}
//让秒表跳一格
function tip(){
if(txt.innerHTML == 1){
//取消定时
window.clearInterval(id);
txt.innerHTML = 1;
}
else{
txt.innerHTML = txt.innerHTML - 1;
}
}
//-->
</script>
把上面的代码复制到一个网页里,直接运行就可以了
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
BODY { FONT-SIZE:12px; MARGIN:auto; FONT-FAMILY:tahoma, Verdana, Arial, Helvetica, sans-serif, "宋体"; }
A { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:link { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:visited { COLOR:#666; FONT-SIZE:12px; TEXT-DECORATION:None }
A:hover { COLOR:#a92400; FONT-SIZE:12px; TEXT-DECORATION:underline }
A:active { TEXT-DECORATION:none }
#Error1 { width:488px; margin:86px auto 0 auto; padding:2px; background:#FAFAFA; border:1px solid #F1F1F1; overflow:hidden; height:1% }
#Error1 .kuan { padding:1px; background:#EFFFD0; border:1px solid #E0E9F1 }
#Error1 .kuan span { font:normal 12px Arial; color:#666; padding:14px 0 10px 50px; margin:5px 20px 0 40px;}
#Error1 .kuan h3 { font:bold 14px Arial; color:#666; border-bottom:1px dashed #CCCCCC; height:36px; padding:5px 0 0 50px; margin:5px 20px 0 40px; background:url(icon_info.gif) no-repeat top left }
.btn { background:#d9d9d9; border-width:1px; vertical-align:middle; height:21px; padding-left:0.15em; padding-right:0.15em; border:1px solid; border-color:#c0c0c0 #555 #555 #c0c0c0; margin-bottom:3px }
</style>
<title>提示信息</title>
</head>
<body onload="s();">
<div id="Error1">
<table align="center" border="0" cellpadding="5" cellspacing="0" class="kuan" width="100%">
<tr>
<td><h3>系统提示您:</h3></td>
</tr>
<tr>
<td><span>操作成功!系统会在<span id="secondvalue">5</span>秒后跳转。<meta http-equiv=refresh Content='5;URL=cssTest.html'></span></td>
</tr>
<tr>
<td><span><a href="cssTest.html">如果没有跳转,请点这里...</a></span></td>
</tr>
</table>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
<!--
//获取表单中的表单域
var txt=document.getElementById("secondvalue");
//定义定时器的id
var id;
function s()
{
id = window.setInterval("tip()",1000);
}
//让秒表跳一格
function tip(){
if(txt.innerHTML == 1){
//取消定时
window.clearInterval(id);
txt.innerHTML = 1;
}
else{
txt.innerHTML = txt.innerHTML - 1;
}
}
//-->
</script>
把上面的代码复制到一个网页里,直接运行就可以了
展开全部
js倒计时:
HTML代码:
<form name="form1">
<div align="center" align="center">
<center>离2010年还有:<br>
<input type="textarea" name="left" size="35" style="text-align: center">
</center>
</div>
</form>
<script LANGUAGE="javascript">
startclock()
var timerID = null;
var timerRunning = false;
function showtime() {
Today = new Date();
var NowHour = Today.getHours();
var NowMinute = Today.getMinutes();
var NowMonth = Today.getMonth();
var NowDate = Today.getDate();
var NowYear = Today.getYear();
var NowSecond = Today.getSeconds();
if (NowYear <2000)
NowYear=1900+NowYear;
Today = null;
Hourleft = 23 - NowHour
Minuteleft = 59 - NowMinute
Secondleft = 59 - NowSecond
Yearleft = 2009 - NowYear
Monthleft = 12 - NowMonth - 1
Dateleft = 31 - NowDate
if (Secondleft<0)
{
Secondleft=60+Secondleft;
Minuteleft=Minuteleft-1;
}
if (Minuteleft<0)
{
Minuteleft=60+Minuteleft;
Hourleft=Hourleft-1;
}
if (Hourleft<0)
{
Hourleft=24+Hourleft;
Dateleft=Dateleft-1;
}
if (Dateleft<0)
{
Dateleft=31+Dateleft;
Monthleft=Monthleft-1;
}
if (Monthleft<0)
{
Monthleft=12+Monthleft;
Yearleft=Yearleft-1;
}
Temp=Yearleft+'年, '+Monthleft+'月, '+Dateleft+'天, '+Hourleft+'小时, '+Minuteleft+'分, '+Secondleft+'秒'
document.form1.left.value=Temp;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
var timerID = null;
var timerRunning = false;
function stopclock () {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
stopclock();
showtime();
}
// -->
</script>
HTML代码:
<form name="form1">
<div align="center" align="center">
<center>离2010年还有:<br>
<input type="textarea" name="left" size="35" style="text-align: center">
</center>
</div>
</form>
<script LANGUAGE="javascript">
startclock()
var timerID = null;
var timerRunning = false;
function showtime() {
Today = new Date();
var NowHour = Today.getHours();
var NowMinute = Today.getMinutes();
var NowMonth = Today.getMonth();
var NowDate = Today.getDate();
var NowYear = Today.getYear();
var NowSecond = Today.getSeconds();
if (NowYear <2000)
NowYear=1900+NowYear;
Today = null;
Hourleft = 23 - NowHour
Minuteleft = 59 - NowMinute
Secondleft = 59 - NowSecond
Yearleft = 2009 - NowYear
Monthleft = 12 - NowMonth - 1
Dateleft = 31 - NowDate
if (Secondleft<0)
{
Secondleft=60+Secondleft;
Minuteleft=Minuteleft-1;
}
if (Minuteleft<0)
{
Minuteleft=60+Minuteleft;
Hourleft=Hourleft-1;
}
if (Hourleft<0)
{
Hourleft=24+Hourleft;
Dateleft=Dateleft-1;
}
if (Dateleft<0)
{
Dateleft=31+Dateleft;
Monthleft=Monthleft-1;
}
if (Monthleft<0)
{
Monthleft=12+Monthleft;
Yearleft=Yearleft-1;
}
Temp=Yearleft+'年, '+Monthleft+'月, '+Dateleft+'天, '+Hourleft+'小时, '+Minuteleft+'分, '+Secondleft+'秒'
document.form1.left.value=Temp;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
var timerID = null;
var timerRunning = false;
function stopclock () {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
stopclock();
showtime();
}
// -->
</script>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询