<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>倒计时</title>
</head>
<body>
120分钟几时开始:
<input type="text" name="usetime" size="8" style="border:0pt">
<script language="javascript">
var hour=2;
var mins=30;
var second=50;
var sec=0;
var min=0;
var hou=0;
var h="";
var m="";
var s="";
function gettime(){
if(hou>=hour&&min>=mins&&sec>=sec)
{
usetime.value="时间结束~" ;
}
else
{
sec=sec+1;
}
if(sec==59)
{
sec=0 ;
min=min+1;
}
if(min==59)
{
min=0 ;
hou=hou+1;
}
h=""+hou+"";
m=""+min+"";
s=""+sec+"";
if(hou<10)
{
h="0"+h;
}
if(min<10)
{
m="0"+m;
}
if(sec<10)
{
s="0"+s;
}
else if(sec<1)
{
sec=00;
}
usetime.value=h+":"+m+":"+s;
}
setInterval("gettime()",100);
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>倒计时</title>
</head>
<body>
<input type="text" name="usetime" size="8" style="border:0pt">
<script language="javascript">
var sec=0;
var min=0;
var hou=2;
var h="";
var m="";
var s="";
function gettime(){
if(sec==0 && min==0 && hou==0)
{
usetime.value="时间结束~" ;
}
else
{
sec=sec-1;
}
if(sec==-1)
{
sec=59 ;
min=min-1;
}
if(min==-1)
{
min=59 ;
hou=hou-1;
}
h=""+hou+"";
m=""+min+"";
s=""+sec+"";
if(hou<10)
{
h="0"+h;
}
if(min<10)
{
m="0"+m;
}
if(sec<10)
{
s="0"+s;
}
else if(sec<1)
{
sec=00;
}
usetime.value=h+":"+m+":"+s;
}
setInterval("gettime()",100);
</script>
</body>
</html>