求解决滚动图片滚动一段时间后停止问题
大家看一下我写的这段代码,不知道什么原因滚动一段时间后就停止不懂了。。请高手解决。<!--#includefile="conn.asp"--><%setrs=server...
大家看一下我写的这段代码,不知道什么原因滚动一段时间后就停止不懂了。。请高手解决。
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from cplb"
rs.open sql,conn,1,1
%>
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
width: 2000;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 90%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
<TABLE border="0" cellpadding="0" cellspacing="0">
<tr>
<%
do until rs.eof
%>
<td width="193">
<table height=189 cellspacing=1 cellpadding=0 width=182 bgcolor=#cccccc border=0>
<tbody>
<tr>
<td width="180" height="187" align=middle valign=center bgcolor=#ffffff><table cellspacing=0 cellpadding=0 width=168
border=0>
<tbody>
<tr>
<td class=hong valign=center align=middle
height=28><font style="font-size: 9pt"> <a target="_blank" href="/cp/chanpin.asp?id=<%=rs("id")%>" style="text-decoration: none"> <font color="#FF0000"><%=rs("cp_title")%></font></a></font></td>
</tr>
<tr>
<td valign=center align=middle><a target="_blank" href="/cp/chanpin.asp?id=<%=rs("id")%>"> <img border="0" src="<%=rs("cp_img")%>" width="168" height="123"></a></td>
</tr>
<tr>
<td class=hong valign=center align=middle
height=5></td>
</tr>
<tr>
<td valign=center align=middle height=19><font size="2"> <a target="_blank" href="/cp/chanpin.asp?id=<%=id%>"> <img
src="shouye/bt01.jpg"
border=0 width="168" height="19"></a></font></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</td>
<%
rs.movenext
loop
%>
</tr></TABLE>
</div>
<div id="demo2"></div>
</div>
</div>
<script>
<!--
var speed=30; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script> 展开
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from cplb"
rs.open sql,conn,1,1
%>
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
width: 2000;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 90%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
<TABLE border="0" cellpadding="0" cellspacing="0">
<tr>
<%
do until rs.eof
%>
<td width="193">
<table height=189 cellspacing=1 cellpadding=0 width=182 bgcolor=#cccccc border=0>
<tbody>
<tr>
<td width="180" height="187" align=middle valign=center bgcolor=#ffffff><table cellspacing=0 cellpadding=0 width=168
border=0>
<tbody>
<tr>
<td class=hong valign=center align=middle
height=28><font style="font-size: 9pt"> <a target="_blank" href="/cp/chanpin.asp?id=<%=rs("id")%>" style="text-decoration: none"> <font color="#FF0000"><%=rs("cp_title")%></font></a></font></td>
</tr>
<tr>
<td valign=center align=middle><a target="_blank" href="/cp/chanpin.asp?id=<%=rs("id")%>"> <img border="0" src="<%=rs("cp_img")%>" width="168" height="123"></a></td>
</tr>
<tr>
<td class=hong valign=center align=middle
height=5></td>
</tr>
<tr>
<td valign=center align=middle height=19><font size="2"> <a target="_blank" href="/cp/chanpin.asp?id=<%=id%>"> <img
src="shouye/bt01.jpg"
border=0 width="168" height="19"></a></font></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</td>
<%
rs.movenext
loop
%>
</tr></TABLE>
</div>
<div id="demo2"></div>
</div>
</div>
<script>
<!--
var speed=30; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script> 展开
1个回答
展开全部
给你个能正常滚动的
<style>
#demo
{
margin-top:12px;
}
td#demo1 img,td#demo2 img
{
width:120px;
height:82px;
margin:2px;
}
td#demo1 td,td#demo2 td
{
border:1px solid #ccc;
}
</style>
<div class="honors">
<div id="demo" style="width: 980px; overflow: hidden; color: #000;">
<table width="980px;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="demo1" valign="top" align="">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><a href="#"><img src="pic/01.jpg"></a></td>
<td><a href="#"><img src="pic/02.jpg"></a></td>
<td><a href="#"><img src="pic/03.jpg"></a></td>
<td><a href="#">img src="pic/04.jpg"></a></td>
<td><a href="#"><img src="pic/05.jpg"></a></td></tr></table></td>
<td id="demo2" valign="top">
</td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
var demo2 = document.getElementById("demo2");
var speed=1;
demo2.innerHTML=demo1.innerHTML;
function Marquee1()
{
if(demo.scrollLeft>=demo2.offsetWidth)
{
demo.scrollLeft-=demo2.offsetWidth ;
}else{
demo.scrollLeft++;
}
}
var MyMar1=setInterval(Marquee1,speed);
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</script>
</div>
<style>
#demo
{
margin-top:12px;
}
td#demo1 img,td#demo2 img
{
width:120px;
height:82px;
margin:2px;
}
td#demo1 td,td#demo2 td
{
border:1px solid #ccc;
}
</style>
<div class="honors">
<div id="demo" style="width: 980px; overflow: hidden; color: #000;">
<table width="980px;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="demo1" valign="top" align="">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><a href="#"><img src="pic/01.jpg"></a></td>
<td><a href="#"><img src="pic/02.jpg"></a></td>
<td><a href="#"><img src="pic/03.jpg"></a></td>
<td><a href="#">img src="pic/04.jpg"></a></td>
<td><a href="#"><img src="pic/05.jpg"></a></td></tr></table></td>
<td id="demo2" valign="top">
</td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
var demo2 = document.getElementById("demo2");
var speed=1;
demo2.innerHTML=demo1.innerHTML;
function Marquee1()
{
if(demo.scrollLeft>=demo2.offsetWidth)
{
demo.scrollLeft-=demo2.offsetWidth ;
}else{
demo.scrollLeft++;
}
}
var MyMar1=setInterval(Marquee1,speed);
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</script>
</div>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询