For annual meeting raffle purposes. Guests will take photos online one by one after entering the venue. After the photos are stored in the database, the photos can be entered into a lottery.
The code is hosted in Open Source China, and you are welcome to download it if you need it.
http://git.oschina.net/caichong/nianhui_choujiang
$(function(){ var alldata = new Array(<?php echo $img;?>); var num = alldata.length - 1; var show = $("#show"); var btn = $("#btn"); var open = false; function change(){ var randomVal = Math.round(Math.random() * num); var prizeName = alldata[randomVal]; show.html("<img src='images/"+prizeName+"' / alt="js annual meeting lottery program" >"); } function run(){ if(!open){ timer=setInterval(change,30); btn.removeClass('start').addClass('stop').text('停止'); open = true; }else{ clearInterval(timer); btn.removeClass('stop').addClass('start').text('开始抽奖'); open = false; } } btn.click(function(){run();}) })