谁能提供一个图片无缝滚动的代码,我是往淘宝店上放的,请提供一个详细的代码,解释的详细还可加分

2023-05-26 综合 38阅读
<!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=gb2312" />
<title></title></head><body>
<br><!--下面是向左滚动代码--><div id="colee_left" style="overflow:hidden;width:500px; height:200px;"><!--width:500px这个是控制宽。height:200px;这个是控制高-->
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="colee_left1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"></p></td>
<td><p><img src=" http://www.alixixi.com/images/noimg.gif"键乎></p></td>
</tr>
</table>
</td>
<td id="colee_left2" valign="top"></td>
</tr>
</table>
</div>
<script>
//使用div时,请保证colee_left2与colee_left1是在同一行上.
var speed=30//速度数值越大速度越慢
var colee_left2=document.getElementById("colee_left2");
var colee_left1=document.getElementById("colee_left1");
var colee_left=document.getElementById("colee_left");
colee_left2.innerHTML=colee_left1.innerHTML
function Marquee3(){
if(colee_left2.offsetWidth-colee_left.scrollLeft<=0)//offsetWidth 是对象的圆亮桥可见宽度
colee_left.scrollLeft-=colee_left1.offsetWidth//scrollWidth 是对象的实际内容的宽,不包边线宽度
else{
colee_left.scrollLeft++
}
}
var MyMar3=setInterval(Marquee3,speed)
colee_left.onmouseover=function() {clearInterval(MyMar3)}
colee_left.onmouseout=function() {MyMar3=setInterval(Marquee3,speed)}
</script><!--向左滚动代码结束-->
</body>
</html>
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com