开始抽奖
var goods = ["法拉利", "宝马", "隔壁老王", "娃娃", "再来一次", "iPhoneX", "别墅", "海景房"];
var _content = document.getElementById("content");
var _start = document.getElementById("start");
var flag = true;
var timer;
function start() {
if (flag) {
flag = false;
_start.innerHTML = "停止抽奖";
_content.className = "selected";
timer = setInterval(function () {
var index = Math.floor(Math.random()*goods.length);
_content.textContent = goods[index];
},10);
} else {
flag = true;
_start.innerHTML = "开始抽奖";
_content.className = "content";
clearInterval(timer);
}
}