<div id="demo" style="overflow:hidden;height:74px;300px;background:#214984;color:#ffffff">
<table>
<tr>
<td id="demo1">
<table>
<tr>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
<td><img src="http://www.html5cn.org/temp/logo_b1.png" /></td>
</tr>
</table>
</td>
<td id="demo2"></td>
</tr>
</div>
<script>
var demo=document.getElementById("demo");
var demo1=document.getElementById("demo1");
var demo2=document.getElementById("demo2");
var speed=30;
demo2.innerHTML=demo1.innerHTML //克隆demo1为demo2
function Marquee(){
if(demo.scrollLeft-demo1.offsetWidth<=0) //当滚动条向左滚动的距离小于等于demo1自身宽度时;
demo.scrollLeft++ ; //滚动条向左滚动加1
else{ //当滚动条向左滚动的距离大于demo1的宽度时;
demo.scrollLeft=0;//滚动条回到最最左
}
}
var MyMar=setInterval(Marquee,speed) //设置定时器
demo.onmouseover=function() {clearInterval(MyMar)}//鼠标移上时清除定时器达到滚动停止的目的
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}//鼠标移开时重设定时器
</script>