关键是怎么改阿?我的代码忘贴了,你把它存为1个文件就行。如下:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body onload=doTimer()>
<input type="button" name="wait" value="暂停" onclick=wait()>
<input name="txt" type="text" id="txt" readonly>
</body>
</html>
<script LANGUAGE="Javascript">
var hour = 2;
var minute = 0;
var second = 0;
var the_timeout;
function doTimer()
{ txt.value = "还有" + hour + "小时" + minute + "分钟" + second +"秒";
if(second!=0){second-=1;}
else
{second=59;
if(minute!=0){minute-=1;}
else
{minute=59;
hour-=1;
}
}
the_timeout = setTimeout("doTimer();", 1000);
}
function wait()
{
clearTimeout(the_timeout);
}
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body onload=doTimer()>
<input type="button" name="wait" value="暂停" onclick=wait()>
<input name="txt" type="text" id="txt" readonly>
</body>
</html>
<script LANGUAGE="Javascript">
var hour = 2;
var minute = 0;
var second = 0;
var the_timeout;
function doTimer()
{ txt.value = "还有" + hour + "小时" + minute + "分钟" + second +"秒";
if(second!=0){second-=1;}
else
{second=59;
if(minute!=0){minute-=1;}
else
{minute=59;
hour-=1;
}
}
the_timeout = setTimeout("doTimer();", 1000);
}
function wait()
{
clearTimeout(the_timeout);
}
</script>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body onload=doTimer()>
<%
if request("a")="rally" then
'按下后把另一个时间变量(或一个session值)赋值为当前时间
end if%>
<input type="button" name="wait" value="暂停" onclick=wait()>
<input type="button" name="wait" value="恢复" onclick=rally()>
<input name="txt" type="text" id="txt">
</body>
</html>
<script LANGUAGE="Javascript">
<%if request("hour")="" then%>
var hour = 2;
<%else%>
var hour = <%=request("hour")%>;
<%end if%>
<%if request("minute")="" then%>
var minute = 0;
<%else%>
var minute = <%=request("minute")%>;
<%end if%>
<%if request("second")="" then%>
var second = 0;
<%else%>
var second = <%=request("second")%>;
<%end if%>
var the_timeout;
function rally(){
second+=1
window.navigate("1.asp?a=rally&txt="+txt.value+"&hour="+hour+"&minute="+minute+"&second="+second)
}
function doTimer()
{ txt.value = "还有" + hour + "小时" + minute + "分钟" + second +"秒";
if(second!=0){second-=1;}
else
{second=59;
if(minute!=0){minute-=1;}
else
{minute=59;
hour-=1;
}
}
the_timeout = setTimeout("doTimer();", 1000);
}
function wait()
{
clearTimeout(the_timeout);
}
</script>我只写了一个恢复的,暂停的,你自己写吧。