Coding青天
2018-01-01 19:25:12浏览 2935
function getDOM(id) {
return document.getElementById(id);
}
var text=getDOM("moocBox");
var con1=getDOM("con1");
var con2=getDOM("con2");
var timer;
var times;
con2.innerHTML=con1.innerHTML;
function startMove() {
text.scrollTop++;
timer=setInterval("scrollUp()",50);
}
function scrollUp() {
if(text.scrollTop % 24 ==0){
clearInterval(timer);
times=setTimeout("startMove()",2000);
}else {
text.scrollTop++;
if(text.scrollTop==con1.offsetHeight){
text.scrollTop=0;
}
}
}
startMove();
text.onmouseover=function () {
clearInterval(timer);
clearTimeout(times);
}
text.onmouseout=function () {
clearInterval(timer);
clearTimeout(times);
timer=setInterval("scrollUp()",50);
}