Home > php教程 > PHP源码 > js annual meeting lottery program

js annual meeting lottery program

大家讲道理
Release: 2016-11-09 09:46:23
Original
2816 people have browsed it

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=&#39;images/"+prizeName+"&#39; / alt="js annual meeting lottery program" >");
        }
         
        function run(){
            if(!open){
                timer=setInterval(change,30);
                btn.removeClass(&#39;start&#39;).addClass(&#39;stop&#39;).text(&#39;停止&#39;);
                open = true;
            }else{
                clearInterval(timer);
                btn.removeClass(&#39;stop&#39;).addClass(&#39;start&#39;).text(&#39;开始抽奖&#39;);
                open = false;
            }
        }
         
        btn.click(function(){run();})
         
    })
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template