function addLoadEvent(func) { var oldonload=window.onload; if (typeof window.onload != 'function') { window.onload=func; } else { window.onload=function() { oldonload(); func(); } } } function getStyle(element,att) { if (element.currentStyle) { return element.currentStyle[att]; } else { return getComputedStyle(element,false)[att]; } } function getByClass(eleParent,eleClass) { var element=eleParent.getElementsByTagName("*"); var eleRrent=[]; for (var i=0; i header_offsetTop) { header.style.position="fixed"; header.style.background="url(images/bg_wood.png) repeat-x"; } else { header.style.position="absolute"; header.style.background="url(images/navBar_relative_bg.png) repeat-x"; } } } function newsTab() { var news=document.getElementById("news"); var tit=getByClass(news,"tit")[0]; var titLi=tit.getElementsByTagName("li"); var con=getByClass(news,"con")[0]; var conUl=con.getElementsByTagName("ul"); for (var i=0;i 0){ noticeList.style.left = -(noticeList.offsetWidth/2)+'px'; } noticeList.style.left = noticeList.offsetLeft + speed + 'px'; } var move = setInterval(moveElement,30); notice.addEventListener('mouseout', function () { move = setInterval(moveElement,30); },false); notice.addEventListener('mousemove', function () { clearInterval(move); },false); } function special() { var special=document.getElementById("special"); var specialList=special.children[0]; var specialLi=specialList.children; for (var i=0;i0 ? Math.ceil(step):Math.floor(step); leader=leader+step; obj.style[k]=leader+"px"; console.log("代码还在运行"); if (leader != target) { flag=false; } } if (flag) { clearInterval(obj.timer); } },15); } } addLoadEvent(navBar); addLoadEvent(header); addLoadEvent(newsTab); addLoadEvent(scrollBanner); addLoadEvent(scrollPicNews); addLoadEvent(service); addLoadEvent(notice); addLoadEvent(special);