js代码
<script type="text/javascript"> //设置显示的所有抽奖名字 list = ['小名','小白','小黑','小红','小绿','小青','小猪',]; //最终抽奖结果会从下面的这个数组里选出 lis = ['小念','小狗狗']; $('#start').click(function(){ $('#jiang').html('等待抽奖中'); immer = setInterval(function(){ num = Math.floor(Math.random() * list.length); $('#box').html(list[num]); },30) }); $('#stop').click(function(){ clearInterval(immer); num1 = Math.floor(Math.random() * lis.length); $('#box').html(lis[num1]); //设置抽奖结果 li = ['跳芭蕾舞','跳脱衣舞','一等奖','跳钢管舞']; (function(){ se = setInterval(function(){ nu = Math.floor(Math.random() * li.length); $('#jiang').html(li[nu]); },30); })(); }); </script> <script type="text/javascript"> setInterval(function(){ var time = new Date(); var y = time.getFullYear(); // 月份取值 0-11 var m = time.getMonth() + 1; var d = time.getDate(); var h = time.getHours(); var i = time.getMinutes(); var s = time.getSeconds(); $('#ji').html(y + '/' + m + '/' + d + ' ' + h + ':' + i + ':' + s); if(s > 0){ clearInterval(se); } },1000); </script>