怎样设置li标记或者div的左右无缝滚动

div1一直到div10,网上看到的左右滚动基本都是table实现,如何利用很多div来实现无缝的左右滚动。

下面是无缝滚动的全部代码,我用的图片的~你全部复制过去自己看看,小改下也可以。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<div id="one" style="overflow:hidden; width:450px; height:300px; background:#069; margin:0px auto;">
<div id="two">
<img src="1.jpg" style="width:450px; height:300px;" />
<img src="3.jpg" style="width:450px; height:300px;" />
<img src="5.jpg" style="width:450px; height:300px;" />
<img src="6.jpg" style="width:450px; height:300px;" />
</div>
<div id="three">
</div>
</div>
<script type="text/javascript" language="javascript">
var speed=30;
var a=document.getElementById("one");
var b=document.getElementById("two");
var c=document.getElementById("three");
c.innerHTML=b.innerHTML;
a.scrollTop=a.scrollHeight;
function Marquee(){
if(b.offsetTop-a.scrollTop>=0)
{
a.scrollTop+=c.offsetHeight;
}
else
{
a.scrollTop--;
}
}
function Stop()
{
clearInterval(MyMar);
}
function Start()
{
MyMar=setInterval(Marquee,speed);
}
var MyMar=setInterval(Marquee,speed);
a.onmouseover=function(){clearInterval(MyMar);}
a.onmouseout=function(){Start();}
</script>
</body>
</html>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-06-08
<style type="text/css">margin:0 ;</style>body里面<div float=left></div>..................................KO
第2个回答  2013-06-08
用表格的好处就是不管多少格都不会换行,用DIV的话超出边界就换行了,没有效果。这没有办法只有将就一下了,还是期待高手吧。本回答被网友采纳
相似回答