标签:
<input type="button" id="btn" value="免费获取验证码" onclick="settime(this)" /></script>
//js倒计时
<html>
<title> 倒计时效果 </title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script language="JavaScript">
var TotalMinutes = 5;
var TotalMilliSeconds = 5*60*1000;
function takeCount()
{
//计数减一
TotalMilliSeconds -= 1000;
//计算时分秒
var hours = Math.floor( TotalMilliSeconds / ( 1000 * 60 * 60 )) % 24;
var minutes = Math.floor(TotalMilliSeconds / (1000 * 60)) % 60;
var seconds = Math.floor(TotalMilliSeconds / 1000) % 60;
//将时分秒插入到html中
document.getElementById("RemainH").innerHTML = hours;
document.getElementById("RemainM").innerHTML = minutes;
document.getElementById("RemainS").innerHTML = seconds;
}
window.onload = setInterval("takeCount();",1000);
</script>
</head>
<body>
<div id="CountMsg">
倒计时还有:
<strong id="RemainD"></strong><strong id="RemainH">XX</strong>时
<strong id="RemainM">XX</strong>分
<strong id="RemainS">XX</strong>秒
</div>
</body>
</html>
标签:
原文地址:http://my.oschina.net/ailingling/blog/495618