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;
}
网友评论