// JavaScript Documentvar data=['iPhone5','50元充值卡','100元超市購物卷','數(shù)碼相機(jī)','謝謝參與!','筆記本電腦','筆記本','SB稱號(hào)','抽個(gè)毛線'];var timer=null;window.onload=function(){?? ?var title=document.getElementById('title'),?? ??? ?begin=document.getElementById('begin'),?? ??? ?stop1=document.getElementById('stop');?? ?begin.onclick=begindraw;?? ?stop1.onclick=function(){?? ??? ?clearInterval(timer);?? ??? ?begin.style.background="#00C";?? ??? ?}?? ??? ?}function begindraw(){?? ??? ?clearInterval(timer);?? ?timer=setInterval(bdraw,50);?? ?this.style.background="#999";?? ?}function bdraw(){?? ?var random1=Math.floor(Math.random()*data.length);?? ?//console.log(random1);?? ?title.innerHTML=data[random1];?? ?}結(jié)果還是一樣可以運(yùn)行沒問題。
為什么我的局部變量沒有引用,程序還是一樣運(yùn)行
L路_ZR
2015-09-10 21:21:47