第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

鼠標(biāo)點(diǎn)開(kāi)始能抽獎(jiǎng),點(diǎn)結(jié)束沒(méi)反映,求大神看一下

<!doctype html>

<html>

<head>

<meta charset="UTF-8">

<title>拖拽效果示例</title>

<style>

div{margin:0 auto;border:1px solid #f00;width:250px;height:130px;}

h1{text-align:center;}

p:nth-of-type(1){float:left;}

p:nth-of-type(2){float:right;}

</style>

<body>

<div>

<h1 id=numarray>開(kāi)始抽獎(jiǎng)啦</h1>

<p id=play>開(kāi)始</p>

<p id=stop>停止</p>

</div>

<script>

var data=['iphone','蘋(píng)果電腦','三星筆記本','50元充值卡','100元現(xiàn)金'];

var numarray=document.getElementById('numarray');

var play=document.getElementById('play');

var stop=document.getElementById('stop');

var timer=null;

// 開(kāi)始抽獎(jiǎng)

play.onclick=playfun;

stop.onclick=stopfun;

document.onkeyup=function(event){

var enter=event.keyCode;

if(enter==13){playfun();}

}

function playfun(){

var timer=setInterval(function(){

var randomm=Math.floor(Math.random()*data.length);

numarray.innerHTML=data[randomm];

},100)

}

function stopfun(){clearInterval(timer);}

</script>

</body>

</html>


正在回答

2 回答

https://img1.sycdn.imooc.com//5b585c340001bbf004940107.jpg

把timer前面var去掉就可以了。

在playfun()函數(shù)里,timer前面加var聲明,這樣timer就成了函數(shù)內(nèi)部變量,在playfun()外部是訪問(wèn)不到的。

0 回復(fù) 有任何疑惑可以回復(fù)我~

https://img1.sycdn.imooc.com//5b166059000118b810670936.jpg這個(gè)比較清晰

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

鼠標(biāo)點(diǎn)開(kāi)始能抽獎(jiǎng),點(diǎn)結(jié)束沒(méi)反映,求大神看一下

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)