一段简单的图片不间断向左移动代码

发布时间:2012年02月08日      浏览次数:885 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div id=demo_next style="overflow:hidden;height:115px;width:500px;">
<TABLE cellPadding=0 height="115" align=left border=0 cellspace="0">
<tr>
<td id=demo2 valign=top height="115" ><img src="1.jpg" height="115" width="160" ></td>
</tr>
</table>
</div>
<SCRIPT>
var speed=20
var Marquee_width=500
do{
demo2.innerHTML+=demo2.innerHTML;
}
while (demo2.scrollWidth<Marquee_width*2)
function Marquee(){
if(demo2.offsetWidth-demo_next.scrollLeft<=Marquee_width)
demo_next.scrollLeft=Marquee_width-40//40=第一幅图片宽度/3
else{
demo_next.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)

demo2.onmouseover=function() {
clearInterval(MyMar)
}
demo2.onmouseout=function() {
MyMar=setInterval(Marquee,speed)
}
</SCRIPT>
</body>
</html>
免责声明:本站相关技术文章信息部分来自网络,目的主要是传播更多信息,如果您认为本站的某些信息侵犯了您的版权,请与我们联系,我们会即时妥善的处理,谢谢合作!