为什么我把函数写道window.onload中就无法运行呢?
var box=document.getElementById("moocBox");
var con1=document.getElementById('con1');
var con2=document.getElementById("con2");
con2.innerHTML=con1.innerHTML;
box.scrollTop=0;
function scro(){
if(box.scrollTop>=con1.scrollHeight){
box.scrollTop=0;
}
else{
box.scrollTop++;
}
}
var timer =setInterval("scro()",50);
box.onmouseover=function(){
clearInterval(timer);
}
box.onmouseout=function(){
timer=setInterval("scro()",50);
}