图片左右循环连续滚动代码,解决marquee的留白问题
向上:
<div id=demo >
<div id=demo1>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
</div>
<div id=demo2>
</div>
</div>
<script language="javascript">
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
useover=function(){clearInterval(MyMar)}
useout=function(){MyMar=setInterval(Marquee,speed)}
</script>
===========================================================================================
向下:
<div id=demo >
<div id=demo1>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
<img src="1.gif"><br><img src="2.gif"><br><img src="3.gif"><br>
</div>
<div id=demo2></div>
</div>
<script language="javascript">
var speed=30
demo2.innerHTML=demo1.innerHTML
demo.scrollTop=demo.scrollHeight
function Marquee(){
if(demo1.offsetTop-demo.scrollTop>=0)
demo.scrollTop+=demo2.offsetHeight
else{
demo.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed)
useover=function(){clearInterval(MyMar)}
怎么把图片做成滚动图片useout=function(){MyMar=setInterval(Marquee,speed)}
</script>
===========================================================================================
向左:
<div id=demo >
<table align=left cellpadding=0 cellspace=0 border=0>
<tr>
<td id=demo1 valign=top >
<img src="1.gif" width="200"><img src="2.gif" width="200" ><img src="3.gif" width="200" ><img src="4.gif" width="200"><img src="5.gif" width="200" ><img src="6.gif" width="200" >
</td>
<td id=demo2 valign=top ></td>
</tr>
</table>
</div>
<script>
var speed=10
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
useover=function(){
clearInterval(MyMar)
}
useout=function(){
MyMar=setInterval(Marquee,speed)
}
</script>
==================================================================================
向右:
<div id=demo >
<table align=left cellpadding=0 cellspace=0 border=0>
<tr>
<td id=demo1 valign=top><img src="1.gif"><img src="2.gif"><img src="3.gif"><img src="4.gif"><img src="5.gif"><img src="6.gif">
</td>
<td id=demo2 valign=top></td>
</tr>
</table>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论