简单定时器

<div id="aa">1</div>
    <script  language="javascript"> 
        var t = 1;
        function timeF() {
            if (t >= 5) {
                window.clearInterval(setIn);
                alert("时间到!");
            }
            document.getElementById("aa").innerHTML = t + "";
            t += 1;
        }
        var setIn = setInterval(timeF, 1000); 
</script>

 

posted @ 2013-11-29 08:54  xyzhuzhou  阅读(169)  评论(0编辑  收藏  举报