// 鼠標(biāo)劃過整個容器時停止自動播放
wrap.onmouseover=function(){
clearInterval(timer);
}
// 鼠標(biāo)離開整個容器時繼續(xù)播放至下一張
wrap.onmouseout=function(){
timer=setInterval(autoPlay,times);
}
wrap.onmouseover=function(){
clearInterval(timer);
}
// 鼠標(biāo)離開整個容器時繼續(xù)播放至下一張
wrap.onmouseout=function(){
timer=setInterval(autoPlay,times);
}
2017-04-28
send.onclick=function(){
send.disabled='disabled';
send.value=times+'秒后重試';
timer=setInterval(function(){
if(--times!=0)
send.value=(times)+'秒后重試';
else{
send.value='發(fā)送驗(yàn)證碼';
send.disabled='';
times=5;
clearInterval(timer);
}
},1000)
send.disabled='disabled';
send.value=times+'秒后重試';
timer=setInterval(function(){
if(--times!=0)
send.value=(times)+'秒后重試';
else{
send.value='發(fā)送驗(yàn)證碼';
send.disabled='';
times=5;
clearInterval(timer);
}
},1000)
2017-04-28
最新回答 / you_belong_to_me
function $(id){? return typeof id==='string'?document.getElementsById(id):id;? }$ ?函數(shù)名。id 參數(shù)如果傳入的id是字符串類型的。返回 document.getElementById(id)
2017-04-25
可以用閉包
for(var i=0;i<titles.length;i++){
(function(){
var temp = i;
titles[temp].onclick=function(){
}
})();
}
for(var i=0;i<titles.length;i++){
(function(){
var temp = i;
titles[temp].onclick=function(){
}
})();
}
2017-04-21
看到有同學(xué)說開定時器前要先關(guān)閉定時器,但是設(shè)置了按鈕禁用之后,你多點(diǎn)幾次也不會出現(xiàn)開幾個定時器的情況啊,禁用下點(diǎn)了沒用,應(yīng)該可以不用清除吧
2017-04-14
最新回答 / 慕斯8234454
定義標(biāo)簽id 不能用數(shù)字開頭,但js 理獲取循環(huán)的標(biāo)簽id 只是代表數(shù)組(標(biāo)簽有很多個,所以才要循環(huán))中的第幾個,并不是HTML 中代表標(biāo)簽的id
2017-04-12
function autochange(){ times--; if(times==0){
send.value="發(fā)送驗(yàn)證碼";
send.style.color="black";
clearInterval(timer); send.disabled=false;
}else{send.value=times+"秒后重試"; } } } }
send.value="發(fā)送驗(yàn)證碼";
send.style.color="black";
clearInterval(timer); send.disabled=false;
}else{send.value=times+"秒后重試"; } } } }
2017-04-08