本文实例为大家分享了js信息滚动效果的具体代码,供大家参考,具体内容如下
>
<script type="text/javascript">
var area = document.getElementById('moocBox');
var con1 = document.getElementById('con1');
var con2 = document.getElementById('con2');
var speed = 50;
area.scrollTop = 0;
con2.innerHTML = con1.innerHTML;
function scrollUp(){
if(area.scrollTop >= con1.scrollHeight) {
area.scrollTop = 0;
}else{
area.scrollTop ++;
}
}
var myScroll = setInterval("scrollUp()",speed);
area.onmouSEOver = function(){
clearInterval(myScroll);
}
area.onmouSEOut = function(){
myScroll = setInterval("scrollUp()",speed);
}