[color=indigo]主要通过setInterval函数实现,当发生鼠标点击或者移动时,网页重新倒计时。具体实现如下:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>html页面倒计时显示</title>
</head>
<script language="JavaScript" type="text/javascript">
var seq = 20;
var second=1000; //间隔时间1秒钟
function scroll() {
document.getElementById('word').innerHTML = seq;
seq--;
if (seq <= 0)
{
//倒计时结束后进行的操作
seq = 20;
}
}
function reCount() {
seq=20;
}
</script>
<body
[b]οnlοad="setInterval('scroll()',second)" [/b]
οnmοusemοve="reCount()" οnmοuseοver="reCount()" οnmοuseup="reCount()" οnmοusedοwn="reCount()"
style="width:500px;height:400px;">
<div id="word"></div>
</body>
</html>
[/color]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>html页面倒计时显示</title>
</head>
<script language="JavaScript" type="text/javascript">
var seq = 20;
var second=1000; //间隔时间1秒钟
function scroll() {
document.getElementById('word').innerHTML = seq;
seq--;
if (seq <= 0)
{
//倒计时结束后进行的操作
seq = 20;
}
}
function reCount() {
seq=20;
}
</script>
<body
[b]οnlοad="setInterval('scroll()',second)" [/b]
οnmοusemοve="reCount()" οnmοuseοver="reCount()" οnmοuseup="reCount()" οnmοusedοwn="reCount()"
style="width:500px;height:400px;">
<div id="word"></div>
</body>
</html>
[/color]