点击开始执行setInterval,过一段时间执行setTimeout

$(".dact-start").click(function(){
        timer=setInterval("showTime()", 100);
        setTimeout(function(){clearInterval(timer);$(".dact-1-2").attr("id","dact-num"+5);}, 4000)
    })
    function showTime()
        {
            var today=Math.floor(Math.random()*8+1);
            $(".dact-1-2").attr("id","dact-num"+today);
        }

点击开始执行setInterval,过一段时间执行setTimeout

posted on 2012-11-20 17:36  lovening  阅读(1630)  评论(0编辑  收藏  举报