var g_Interval = 1;var g_PersonCount = 500;//参加抽奖人数var g_Timer;var running = false;function beginRndNum(trigger){ if(running){ running = false; clearTimeout(g_Timer); $(trigger).val("开始"); $('#ResultNum').css('color','red'); } else{ running = true; $('#ResultNum').css('color','black'); $(trigger).val("停止"); beginTimer(); }}function updateRndNum(){ var num = Math.floor(Math.random()*g_PersonCount+1); $('#ResultNum').html(num);}function beginTimer(){ g_Timer = setTimeout(beat, g_Interval);}function beat() { g_Timer = setTimeout(beat, g_Interval); updateRndNum();}
添加回答
举报
0/150
提交
取消