美文网首页
someting funny

someting funny

作者: memore | 来源:发表于2015-05-04 16:45 被阅读16次
    window.onload = function () {
        var i = 1;
        var lottery = new Lottery('lotteryContainer', '#CCC', 'color', 450, 100, drawPercent);
        lottery.init(getRandomStr(i), 'text');
    
        document.getElementById('freshBtn').onclick = function() {
            drawPercentNode.innerHTML = '0%';
            lottery.init(getRandomStr(++i), 'text');
         }
        
        var drawPercentNode = document.getElementById('drawPercent');
        
        function drawPercent(percent) {
            drawPercentNode.innerHTML = percent + '%';
        }
        
    }
    
    function getRandomStr(n) {
        var text = "";
        switch(n)
            {
                case 1: text="Today is 5.10 and ......"; break;
                case 2: text="happy birthday to ......"; break;
                case 3: text="everyone born today in history"; break;
                case 4: text="especially you!"; break;
                case 100: text="if you refresh 100 times"; break;
                case 101: text="you'll see that"; break;
                case 102: text="actually i have more words"; break;
                case 103: text="to say but"; break;
                case 104: text="you can't hear them"; break;
                default: text="For HRQ's Flowery 22."
            }
        return text;
    }
    

    相关文章

      网友评论

          本文标题:someting funny

          本文链接:https://www.haomeiwen.com/subject/rrcifttx.html