日期:2014-05-17 浏览次数:21498 次
<style>
#o{ width:500px;height:25px;overflow:hidden;}
#o #i{width:1000px; height:25px}
#o #i div{width:500px;height:25px; float:left;}
</style>
<div id='o'>
<div id='i'>
<div id='s'>123456123456123456123456</div>
</div>
</div>
<script>
var o = document.getElementById('o')
var i = document.getElementById('i')
var s = document.getElementById('s')
var speed = 10
i.appendChild(s.cloneNode(true));
function scroll()
{
if(o.scrollLeft >= o.offsetWidth) o.scrollLeft = 0
o.scrollLeft += 4;
}
var t = window.setInterval(scroll,speed)
o.onmouseover = function(){window.clearInterval(t)}
o.onmouseout = function(){t = window.setInterval(scroll,speed)}
</script>