展开全部
上网去当个,有很多。
<!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" />
<title></title>
<script language="javascript" type="text/javascript">
var h,m,s,hstr,mstr,sstr,timestr;
var etime = 80 * 60; //总秒数
function timer()
{
h = Math.floor(etime / 3600); //时
m = Math.floor(etime / 60) % 60; //分
s = Math.floor(etime % 60); //秒
h < 0 ? h = 0 : h = h;
m < 0 ? m = 0 : m = m;
s < 0 ? s = 0 : s = s;
h.toString().length < 2 ? hstr = "0" + h.toString() : hstr = h; //1显示01
m.toString().length < 2 ? mstr = "0" + m.toString() : mstr = m; //1显示01
s.toString().length < 2 ? sstr = "0" + s.toString() : sstr = s; //1显示01
timestr = hstr + ":" + mstr + ":" + sstr;
txt.value = timestr;
etime = etime - 1;
}
</script>
</head>
<body onload="window.setInterval('timer()',1000);">
<input type="button" id="txt" name="txt" value="" />
</body>
</html>
<!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" />
<title></title>
<script language="javascript" type="text/javascript">
var h,m,s,hstr,mstr,sstr,timestr;
var etime = 80 * 60; //总秒数
function timer()
{
h = Math.floor(etime / 3600); //时
m = Math.floor(etime / 60) % 60; //分
s = Math.floor(etime % 60); //秒
h < 0 ? h = 0 : h = h;
m < 0 ? m = 0 : m = m;
s < 0 ? s = 0 : s = s;
h.toString().length < 2 ? hstr = "0" + h.toString() : hstr = h; //1显示01
m.toString().length < 2 ? mstr = "0" + m.toString() : mstr = m; //1显示01
s.toString().length < 2 ? sstr = "0" + s.toString() : sstr = s; //1显示01
timestr = hstr + ":" + mstr + ":" + sstr;
txt.value = timestr;
etime = etime - 1;
}
</script>
</head>
<body onload="window.setInterval('timer()',1000);">
<input type="button" id="txt" name="txt" value="" />
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |