window.onload=function(){
var oDemo=document.getElementById("demo");
var odemo1=document.getElementById("demo1");
var aDl=odemo1.getElementsByTagName("dl");
var timer=null;
var iSpeed=-5;
odemo1.innerHTML+=odemo1.innerHTML; (动态增加图片为原来的2倍)
odemo1.style.width=aDl[0].offsetWidth*aDl.length+"px"; (ul的宽度为每个li宽度之和)
timer=setInterval(function(){
odemo1.style.left=odemo1.offsetLeft+iSpeed+"px";
if(odemo1.offsetLeft<-odemo1.offsetWidth/2){
odemo1.style.left="0px"; //当运动到一半的时候就往回拉
}
},200);
odemo1.onmouseover=function(){
clearInterval(timer);
}
odemo1.onmouseout=function(){
timer=setInterval(function(){
odemo1.style.left=odemo1.offsetLeft+iSpeed+"px";
if(odemo1.offsetLeft<-odemo1.offsetWidth/2){
odemo1.style.left="0px";
}
},200);
}
}