如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<div id="demo" style="clear:both; overflow:hidden; height:134px;width:188px;margin:0 auto;">
<div id="demo1">
<!-- 定义图片 -->
<ul>
<li><img src="images/pic/jycy_02.jpg" width="188" height="134" /></li>
<li><img src="images/pic/jycy_03.jpg" width="188" height="134" /></li>
<li><img src="images/pic/jycy_04.jpg" width="188" height="134" /></li>
<li><img src="images/pic/jycy_05.jpg" width="188" height="134" /></li>
</ul></div>
<div id="demo2"></div>
</div>
<script>
var speed=30
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){
if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0)
document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight
else{
document.getElementById("demo").scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").οnmοuseοver=function() {clearInterval(MyMar)}
document.getElementById("demo").οnmοuseοut=function() {MyMar=setInterval(Marquee,speed)}
</script>
</body>
</html>