將onmouseover改成onclick為什么實現(xiàn)不了點擊切換?
function $(id){
?? ??? ??? ?return typeof id==='string'?document.getElementById(id):id;
?? ??? ?}
?? ??? ?window.onload=function(){
?? ??? ??? ?var titles=$('menu').getElementsByTagName('li');
?? ??? ??? ???? contents=$('notice').getElementsByTagName('div');
?? ??? ??? ? if (titles.length!=contents.length)
?? ??? ??? ? ?? ?return;
?? ??? ??? ? for (var i = 0; i < titles.length; i++) {
?? ??? ??? ? ?? ?titles[i].id=i;
?? ??? ??? ? ?? ?titles[i].onmouseover=function(){
?? ??? ??? ? ?? ??? ?for (var j = 0; j < titles.length; j++) {
?? ??? ??? ? ?? ??? ??? ?titles[j].className="";
?? ??? ??? ? ?? ??? ??? ?contents[j].style.display="none";
?? ??? ??? ? ?? ??? ?}
?? ??? ??? ? ?? ??? ?this.className="active";
?? ??? ??? ? ?? ??? ?contents[this.id].style.display="block";
?? ??? ??? ? ?? ?}
?? ??? ??? ? }
?? ??? ?}
2017-06-05
我不會 但是網(wǎng)頁老是出提醒 怪煩的 我覺得我回答一下 網(wǎng)頁就不會再彈出窗口了