为了账号安全,请及时绑定邮箱和手机立即绑定

请问这个函数的弊端在哪里 问题在哪里有人帮忙分析一下吗

请问这个函数的弊端在哪里 问题在哪里有人帮忙分析一下吗

qq_小狼丶_03974697 2016-10-10 09:31:52
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);//清楚第二个定时器         companyContent.timer1=setInterval(function(){//开启第一个定时器             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();     } }
查看完整描述

1 回答

?
我是大牛你信么

TA贡献9条经验 获得超2个赞

不是挺好的么

查看完整回答
反对 回复 2016-10-10
  • 1 回答
  • 1 关注
  • 1296 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信