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

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

求解:鍵盤(pán)事件只能執(zhí)行一次

window.onload=function(){
????????var?box=document.getElementById('divselect'),
????????????title=box.getElementsByTagName('cite')[0],
????????????menu=box.getElementsByTagName('ul')[0],
????????????as=box.getElementsByTagName('a'),
????????????index=-1,
????????????flag=0;

????????//鍵盤(pán)事件
????????document.onkeyup=function(e){
????????????e=e||window.event;
????????????if(e.keyCode==13){
????????????????menu.style.display='block';
????????????????flag=1;
????????????????document.onkeyup=function(e){
????????????????????e=e||window.event;
????????????????????if(e.keyCode==40){????????//按下方向鍵
????????????????????????clear();
????????????????????????index++;
????????????????????????if(index>=as.length){
????????????????????????????index=0;
????????????????????????}
????????????????????????change();
????????????????????}

????????????????????if(e.keyCode==38){????????//按上方向鍵
????????????????????????clear();
????????????????????????index--;
????????????????????????if(index<0){
????????????????????????????index=as.length-1;
????????????????????????}
????????????????????????change();
????????????????????}
????????????????????if(e.keyCode==13?&&?index!=-1){
????????????????????????title.innerHTML=as[index].innerHTML;
????????????????????????menu.style.display='none';
????????????????????????index=-1;
????????????????????}else?if(e.keyCode==13?&&?flag==1){
????????????????????????menu.style.display='none';
????????????????????????flag=0;
????????????????????}
????????????????????return?flag,index;
????????????????}
????????????}
????????????function?clear(){
????????????????for(var?i=?0,l=as.length;i<l;i++){
????????????????????as[i].style.background='#fff';
????????????????????as[i].style.color='#333';
????????????????}
????????????}
????????????function?change(){
????????????????as[index].style.background='#333';
????????????????as[index].style.color='#fff';
????????????}

????????}


????????//?點(diǎn)擊三角時(shí)
????????title.onclick=function(event){

????????????//list粗線
????????????event=event||window.event;
????????????if(event.stopPropagation){
????????????????event.stopPropagation();
????????????}else{
????????????????event.cancelBubble=true;
????????????}
????????????menu.style.display='block';

????????????for(var?i=?0,l=as.length;i<l;i++){?????????//滑過(guò)變色
????????????????as[i].onmouseover=function(){
????????????????????this.style.background='#333';
????????????????????this.style.color='#fff';
????????????????};
????????????????as[i].onmouseout=function(){
????????????????????this.style.background='#fff';
????????????????????this.style.color='#333';
????????????????};
????????????????as[i].onclick=function(e){
????????????????????e=e||window.event;
????????????????????if(e.stopPropagation){
????????????????????????e.stopPropagation();
????????????????????}else{
????????????????????????e.cancelBubble=true;
????????????????????}
????????????????????menu.style.display='none';??????????????//list消失

????????????????????title.innerHTML=this.innerHTML;?????????//改變標(biāo)題
????????????????}

????????????}

????????}
????????document.onclick=function(){
????????????menu.style.display='none';
????????}

代碼如上,用鍵盤(pán)操作一次后,再次按回車鍵就沒(méi)反應(yīng)了,請(qǐng)問(wèn)是什么原因?

html和css均未修改

正在回答

1 回答

補(bǔ)充:鼠標(biāo)問(wèn)題沒(méi)有問(wèn)題

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

舉報(bào)

0/150
提交
取消

求解:鍵盤(pán)事件只能執(zhí)行一次

我要回答 關(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)