求图片从右向左不间断滚动代码 20
向左滚动<marqueescrollamount="1"scrolldelay="20"width="96%"id=xiaoqingheight="240"onmouse...
向左滚动 <marquee scrollamount="1" scrolldelay="20" width="96%" id=xiaoqing height="240" onmouseover=xiaoqing.stop() onmouseout=xiaoqing.start()>需要滚动的内容</marquee>
我这段代码首尾不能衔接,滚动完后留下一段空白,求哪位高人赐不间断滚动代码 展开
我这段代码首尾不能衔接,滚动完后留下一段空白,求哪位高人赐不间断滚动代码 展开
1个回答
展开全部
<!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>
<!--下面是向左滚动代码-->
<div id="colee_left" style="overflow:hidden;width:500px;">
<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.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></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>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<!--下面是向左滚动代码-->
<div id="colee_left" style="overflow:hidden;width:500px;">
<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.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></p></td>
<td><p><img src="http://www.codefans.net/jscss/demoimg/200907/bg3.jpg"></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>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询