var area = document.getElementsByClassName('moocBox')
var con1 = document.getElementsByClassName('con1');
var con2 = document.getElementsByClassName('con2');
con2[0].innerHTML = con1[0].innerHTML;
var iliheight = 24;
area[0].scrollTop = 0;
function scrollrun(){
area[0].scrollTop++;
if(area[0].scrollTop / iliheight == 0)
{
clearInterval(time);
}
}
var time = setInterval("scrollrun()",50);看出问题来没有?当使用getElementsByClassName时取得是一个类数组,需要加索引来取值,你打开控制台看一下,肯定是报错的,欢迎采纳