已采納回答 / wangjunjia
var event = event || window.event; 賦值return event ? event : window.event; 函數(shù)返回值
2017-03-05
最新回答 / 帥弟弟
看不到你代碼 不知道是不是這個原因。?/* 在實(shí)例中,我們使用了支持多瀏覽器的方法,因?yàn)?keyCode 屬性無法再 Firefox 瀏覽器中工作。但是 which 屬性可以。如果瀏覽器支持 event.which 則使用 event.which,否則使用 event.keyCode */function myFunction(event) {? ? var x = event.which || event.keyCode;? ?}
2017-03-05
已采納回答 / frontendsophie
23行應(yīng)該是event.stopPropagation(); ? ?另外document的onclick事件里阻止冒泡沒意義- -
2017-03-04
title.onclick=function(event){//選擇分類
event=event||window.event;
if(event.stopPropagation){
event.stopPropagation();
}else{
event.cancelBubble=true;
}
menu.style.display="block";
}
event=event||window.event;
if(event.stopPropagation){
event.stopPropagation();
}else{
event.cancelBubble=true;
}
menu.style.display="block";
}
2017-03-04
for(var i=0,j=as.length;i<j;i++){
as[i].onmouseover=function(){//鼠標(biāo)滑過
this.style.background="#567";
}
as[i].onmouseout=function(){//鼠標(biāo)離開
this.style.background="#fff";
}
as[i].onclick=function(){//鼠標(biāo)點(diǎn)擊
title.innerHTML=this.innerHTML;
}
}
as[i].onmouseover=function(){//鼠標(biāo)滑過
this.style.background="#567";
}
as[i].onmouseout=function(){//鼠標(biāo)離開
this.style.background="#fff";
}
as[i].onclick=function(){//鼠標(biāo)點(diǎn)擊
title.innerHTML=this.innerHTML;
}
}
2017-03-04
document.onclick=function(){//窗體點(diǎn)擊
menu.style.display="none";
}
menu.style.display="none";
}
2017-03-04
document.onkeyup=function(event){//鍵盤操作
event=event||window.event;
var LisCount=as.length-1;
event=event||window.event;
var LisCount=as.length-1;
2017-03-04
if(event.keyCode==40){//向下
if(index==-1){
index=0;
}else{
as[index].style.background="#fff";
if(index==LisCount){
index=0;
}else{
index++;
}
}
as[index].style.background="#567";
}
if(index==-1){
index=0;
}else{
as[index].style.background="#fff";
if(index==LisCount){
index=0;
}else{
index++;
}
}
as[index].style.background="#567";
}
2017-03-04
if(event.keyCode==38){//向上
if(index==-1){
index=LisCount;
}else{
as[index].style.background="#fff";
if(index==0){
index=LisCount;
}else{
index--;
}
}
as[index].style.background="#567";
}
if(index==-1){
index=LisCount;
}else{
as[index].style.background="#fff";
if(index==0){
index=LisCount;
}else{
index--;
}
}
as[index].style.background="#567";
}
2017-03-04
if(event.keyCode==13){//回車
title.innerHTML=as[index].innerHTML;
index=-1;
menu.style.display="none";
}
title.innerHTML=as[index].innerHTML;
index=-1;
menu.style.display="none";
}
2017-03-04