script Language="javascript"
var seconds = 10;//记数时间
var handle;//事件柄
//开始记数器
function startTimer() {
handle = setInterval("timer()",1000);
}
//结束记数器
function stopTimer() {
clearInterval(handle);
seconds = 10;
document.all.redhacker.innerHTML = "10秒钟倒计时完成";
}
//计数器
function timer() {
seconds -= 1;
document.all.redhacker.innerHTML = "您还有 font color='red'" + seconds + "/font 秒";
if (seconds == 0) {
stopTimer();
document.reTranForm.submit();
}
}
//1秒后显示计数器
setTimeout("startTimer()",1000);
/script
div id="redhacker"/div
猜你喜欢