var data=['iphone 5','ipad','佳能相机','谢谢参与'],
timer=null;
window.onload=function(){
var title=document.getElementById('title'),
play=document.getElementById('play'),
stop=document.getElementById('stop');
//开始抽奖
play.onclick=playFun;
stop.onclick=stopFun;
}
function playFun() {
clearInterval(timer);
var title=document.getElementById('title'),
timer=setInterval(function(){
var random=Math.floor(Math.random()*data.length);
title.innerHTML=data[random];
},50);
this.style.background='#999';
}
function stopFun(){
clearInterval(timer);
var play=document.getElementById('play');
play.style.background="#036";
}
playFun函数里var title=document.getElementById('title'),最后是分号不是逗号