网页制作里怎样使滚动图片首尾连接起来?
展开全部
网站常用的向左滚动 首尾相接
你可以把图片衔接的路径改成你电脑上的就行了.宽度,长度你可以自己改.
<div id="demo" style="overflow:hidden;width:600px;color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td><td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
你可以把图片衔接的路径改成你电脑上的就行了.宽度,长度你可以自己改.
<div id="demo" style="overflow:hidden;width:600px;color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td><td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
<td><img src="http://www.22333.com/d/file/20081121/22d2b6ed5808a223d5284a865844c695.gif"><td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询