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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

應(yīng)該如何封裝

應(yīng)該如何封裝

檸檬小茶 2016-10-12 10:54:37
這些代碼有很多相似的地方,如果想封裝的話請(qǐng)問應(yīng)該怎么封裝起來window.onload=function(){?var? pic=document.getElementById('pic'),?? ?? oPli=pic.getElementsByTagName('li'),????? list=document.getElementById('list').getElementsByTagName('a');?? ??? ??? ??? ??? ?for(i=0;i<list.length;i++){?? ??? ??? ?list[i].index=i;?? ??? ??? ?list[i].onmouseover=function(){?? ??? ??? ??? ?for(j=0;j<list.length;j++){?? ??? ??? ??? ??? ?list[j].style.backgroundColor="";?? ??? ??? ??? ??? ?oPli[j].style.display='none'?? ??? ??? ??? ??? ?}?? ??? ??? ??? ?this.style.backgroundColor='#ec4828'?? ??? ??? ??? ?oPli[this.index].style.display='block';?? ??? ??? ?}?? ??? ?}?? ??? ??? ??? ??? ??? ?var lunbo=function(){?? ?var oTab=document.getElementById('new-title');?? ?var oLi=oTab.getElementsByTagName('li');?? ?var oCon=document.getElementById('oo');?? ?var divs=oCon.getElementsByTagName('ul');?? ?for(i=0;i<oLi.length;i++){?? ??? ?oLi[i].index=i;?? ??? ?oLi[i].onmouseover=function(){?? ??? ??? ?for(var j=0;j<oLi.length;j++){?? ??? ??? ??? ??? ??? ??? ?divs[j].className='hide';?? ??? ??? ??? ??? ??? ??? ?}?? ??? ??? ?divs[this.index].className='xinwen show';?? ??? ??? ??? ?}?? ?}}lunbo();var menu=function(){?? ?var oTab=document.getElementById('menu-tit');?? ?var oLi=oTab.getElementsByTagName('li');?? ?var divs=document.getElementsByClassName('menu-list-panel');?? ?timer=null;?? ?for(i=0;i<oLi.length;i++){?? ??? ?oLi[i].index=i;?? ??? ?oLi[i].onmouseover=function(){?? ??? ??? ?divs[this.index].className='menu-list-panel show';?? ??? ??? ??? ?}?? ??? ?oLi[i].onmouseout=function(){?? ??? ??? ??? ??? ??? ?divs[this.index].className='menu-list-panel hide'?? ??? ??? ??? ??? ??? ??? ??? ?}?? ?? }?? ?}menu();var aClick=function(){?? ?var oTab=document.getElementById('act-nav');?? ?var oLi=oTab.getElementsByTagName('li');?? ?var oCon=document.getElementsByClassName('act-list');?? ??? ?for(i=0;i<oLi.length;i++){?? ??? ??? ?oLi[i].index=i;?? ??? ??? ?oLi[i].onclick=function(){?? ??? ??? ??? ?for(var j=0;j<oLi.length;j++){?? ??? ??? ??? ??? ?oLi[j].className=''?? ??? ??? ??? ??? ?oCon[j].className='act-list hide';?? ??? ??? ??? ??? ??? ??? ??? ??? ?}?? ??? ??? ??? ?oLi[this.index].className='on'?? ??? ??? ??? ?oCon[this.index].className='act-list show';?? ??? ??? ??? ??? ??? ??? ?}?? ??? ?}?? ??? ?}aClick();var showTime=function(){?? ? var endtime=new Date("2016/11/6,0:0:0");?? ? var nowtime=new Date();?? ? var lefttime=parseInt((endtime.getTime()-nowtime.getTime())/1000);?? ? var d1=parseInt(lefttime/(24*60*60));?? ? document.getElementById('daoshu').innerHTML=d1+"天后結(jié)束"?? ? ?? ? }showTime();var video=function(){?? ?var oTab=document.getElementById('video-nav');?? ?var oLi=oTab.getElementsByTagName('li');?? ?var oCon=document.getElementById('video-bd');?? ?var vLi=oCon.getElementsByTagName('ul')?? ??? ?for(i=0;i<oLi.length;i++){?? ??? ??? ?oLi[i].index=i;?? ??? ??? ?oLi[i].onclick=function(){?? ??? ??? ??? ?for(var j=0;j<oLi.length;j++){?? ??? ??? ??? ??? ?oLi[j].className=''?? ??? ??? ??? ??? ?vLi[j].className='hide';?? ??? ??? ??? ??? ??? ??? ??? ??? ?}?? ??? ??? ??? ?oLi[this.index].className='on'?? ??? ??? ??? ?vLi[this.index].className='show';?? ??? ??? ??? ??? ??? ??? ?}?? ??? ?}?? ??? ?}video();var xiaoshuo=function(){?? ?var oTab=document.getElementById('xsli');?? ?var oLi=oTab.getElementsByTagName('li');?? ?var vLi=document.getElementsByClassName('novel-bd');?? ??? ?for(i=0;i<oLi.length;i++){?? ??? ??? ?oLi[i].index=i;?? ??? ??? ?oLi[i].onmouseover=function(){?? ??? ??? ??? ?for(var j=0;j<oLi.length;j++){?? ??? ??? ??? ??? ?oLi[j].className=''?? ??? ??? ??? ??? ?vLi[j].className='novel-bd hide';?? ??? ??? ??? ??? ??? ??? ??? ??? ?}?? ??? ??? ??? ?oLi[this.index].className='nov-on'?? ??? ??? ??? ?vLi[this.index].className='novel-bd';?? ??? ??? ??? ??? ??? ??? ?}?? ??? ?}?? ??? ?}xiaoshuo();}
查看完整描述

1 回答

  • 1 回答
  • 2 關(guān)注
  • 1225 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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