急需一个连续不间断的跑马灯的代码

急需一个连续不间断的跑马灯的代码,第1张

我这有个精简版的连续不间断的跑马灯的代码js的:<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

</head>

<body>

<div id=roll1 style="OVERFLOW:hiddenWIDTH:450px">

<table>

<tr>

<td id=rollleft1>

<table>

<tr>

<td>1111111111111111</td>

<td>2222222222222222</td>

<td>3333333333333333</td>

<td>4444444444444444</td>

</tr>

</table>

</td>

<td id=rollright1></td>

</tr>

</table>

</div>

<table>

<tr>

<td>

<SCRIPT language=JavaScript type=text/JavaScript>

var speed1=22

rollright1.innerHTML=rollleft1.innerHTML

function Marquee1(){

if(rollright1.offsetWidth-roll1.scrollLeft<=0)

roll1.scrollLeft-=rollleft1.offsetWidth

else{

roll1.scrollLeft++

}

}

var MyMar1=setInterval(Marquee1,speed1)

roll1.onmouseover=function() {clearInterval(MyMar1)}

roll1.onmouseout=function() {MyMar1=setInterval(Marquee1,speed1)}

</SCRIPT>

</td>

</tr>

</table>

</body>

</html>

<div id="demo" style="overflow:hiddenwidth:600pxcolor:#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="图片路径" width="100"></td>

<td><img src="图片路径" width="100"></td>

<td><img src="图片路径" width="100"></td>

<td><img src="图片路径" width="100"></td>

<td><img src="图片路径" width="100"></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>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7238481.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存