效果: 代码: 复制代码 代码如下: <BR> #div1<BR> {<BR> width: 245px;<BR> height: 150px;<BR> background: red;<BR> margin: 250px;<BR> margin-left: 500px;<BR> position: absolute;<BR> overflow: hidden;<BR> }<BR> #div1 ul li<BR> {<BR> float: left;<BR> width: 44px;<BR> height: 66px;<BR> margin-top: 20px;<BR> margin-right: 5px;<BR> list-style: none;<BR> }<BR> #div1 ul<BR> {<BR> width: 250px;<BR> position: absolute;<BR> padding: 0;<BR> }<BR> <BR> window.onload = function () {<BR> var oul = document.getElementsByTagName('ul')[0];<BR> var odiv = document.getElementById('div1');<BR> var ali = document.getElementsByTagName('li');<BR> oul.innerHTML = oul.innerHTML + oul.innerHTML;<BR> oul.style.width = (ali[0].offsetWidth + 5) * ali.length + 'px';<BR> function roll() {<BR> if (oul.offsetLeft <= -oul.offsetWidth / 2) {<BR> oul.style.left = '0';<BR> }<BR> oul.style.left = oul.offsetLeft - 2 + 'px';<BR> }<BR> var timer = null;<BR> timer = setInterval(roll, 30);<BR> odiv.onmouseover = function () {<BR> clearInterval(timer);<BR> }<BR> odiv.onmouseout = function () {<BR> timer = setInterval(roll, 30);<BR> }<BR> };<BR>