為啥我的不能停止?求助
var data=['iphone 5','ipad','佳能相機(jī)','謝謝參與'],
timer=null;
window.onload=function(){
var title=document.getElementById('title'),
play=document.getElementById('play'),
stop=document.getElementById('stop');
//開(kāi)始抽獎(jiǎng)
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";
}?
2016-08-28
playFun函數(shù)里var title=document.getElementById('title'),最后是分號(hào)不是逗號(hào)