点击开始执行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
浙公网安备 33010602011771号