function?companyMove(){
????var?bigBox=document.getElementById('company_box');
????var?companyContent=getByClass(bigBox,'company_content');
????var?oListsWidth=parseInt(getStyle(companyContent[0],'width'));
????var?oListsHeight=getStyle(companyContent[0],'height');
????var?companyBox=getByClass(bigBox,'company_content_box')[0];
????var?oBtn=document.getElementById('company_btn');
????var?aBtnLists=oBtn.getElementsByTagName('a');
????var?onNow=0;
????
????companyContent.timer1=null;
????companyContent.timer2=null;
????companyBox.style.width=parseInt(oListsWidth)*companyContent.length+'px';
????//alert(companyBox.style.width);
????
????//aBtnLists[1].className='company_btn_checked';
????function?a(){
????????clearInterval(companyContent.timer2);//清楚第二個(gè)定時(shí)器
????????companyContent.timer1=setInterval(function(){//開啟第一個(gè)定時(shí)器
????????????onNow+=-oListsWidth;
????????????startMove(companyBox,{left:onNow},15);????????????
????????????if(onNow<=-oListsWidth*(companyContent.length-1))
????????????{
????????????????b();
????????????}
????????????for(var?i=0?;?i<aBtnLists.length?;?i++)
????????????{
????????????????aBtnLists[i].className='';
????????????}
????????????aBtnLists[Math.abs(onNow/oListsWidth)].className='company_btn_checked';
????????},5000);????
????}
????function?b(){
????????clearInterval(companyContent.timer1);
????????companyContent.timer2=setInterval(function(){
????????????onNow+=oListsWidth;
????????????startMove(companyBox,{left:onNow},15);????????
?????????????if(onNow>=0)
????????????{????????
????????????????a();
????????????}????????
????????????for(var?i=0?;?i<aBtnLists.length?;?i++)
????????????{
????????????????aBtnLists[i].className='';????
????????????}
????????????aBtnLists[Math.abs(onNow/oListsWidth)].className='company_btn_checked';
????????????
????????????
????????},5000);
????}
????
????a();
????
????companyBox.onmouseover=function(){
????????clearInterval(companyContent.timer1);
????????clearInterval(companyContent.timer2);
????}
????companyBox.onmouseout=function(){
????????a();
????}
}
請(qǐng)問這個(gè)函數(shù)的弊端在哪里 問題在哪里有人幫忙分析一下嗎
qq_小狼丶_03974697
2016-10-10 09:31:52