IT Notes‎ > ‎Programming Language‎ > ‎JavaScript‎ > ‎

一段顯示倒計時的JS代碼

來源:http://www.javaworld.com.tw/jute/post/view?bid=29&id=233088 中的 kebin_liu。

這里下載,內容如下:
<html>
<head>
<script type="text/javascript">
var t;
function timedCount() {
    document.getElementById('txt').innerHTML -= 1;
    if (document.getElementById('txt').innerHTML > 0) {
        t = setTimeout("timedCount()", 1000);
    }
    if (document.getElementById('txt').innerHTML == 0) {
        window.open('http://en.wikipedia.org', '_self');
    }
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body onload="timedCount()">
    <span id="txt">11</span>
</body>
</html>
ċ
倒計時.htm.txt
(1k)
Iridium Cao,
Jul 3, 2008, 1:29 AM
Comments