其中的-3是为了弥补IE下抖一下的问题
在火狐下是-7
<style type="text/css">
<!--
#demo {
overflow:hidden;
border: 1px dashed #CCC;
width: 400px;
height:100px;
}
#indemo {
float: left;
width:5000%;
}
-->
</style>
<div id="demo">
<div id="indemo">
<span id="demo1">
<img src="" /><img src="" /><img src="" /><img src="" /><img src="" /><img src="" /></span>
<span id="demo2"></span>
</div>
</div>
<script>
<!--
var speed=10;
demo2.innerHTML=demo1.innerHTML;
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft == -3)
demo.scrollLeft = 0;
else{
demo.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
demo.onmouseover=function() {clearInterval(MyMar)};
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>
本文链接http://www.cxybl.com/html/wyzz/CSS/20130702/38855.html