asp中怎样从数据库中调用图片,并实现图片从右到左连续不断地滚动……
我这里有一段代码,但图片从右到左滚动时,总有一段时间是空白的,怎样改可以实现图片连续不断地滚动……高手们,拜托啦!(调用图片、连续滚动都会,但两者加一块就不知道怎么整啦,...
我这里有一段代码,但图片从右到左滚动时,总有一段时间是空白的,怎样改可以实现图片连续不断地滚动……高手们,拜托啦!(调用图片、连续滚动都会,但两者加一块就不知道怎么整啦,所以,请直接在这段代码上修改,可以让我直接复制过去就可以用)
<td colspan="20" rowspan="3" valign="top" bgcolor="#FFFFFF"><!--新闻图片-->
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="144" colspan="2" background="Images/gundongbg.gif"><marquee id="marqueeArea" behavior="scroll" scrollamount="2" scrolldelay="50" loop="infinite" direction="left" height="125" onMouseOver=this.stop(); onMouseOut=this.start()>
<%
set RsPic=server.createobject("adodb.recordset")
sql="select top 8 * from News where Ispic=1 ORDER BY id DESC"
RsPic.open sql,conn,1,1
if RsPic.eof or RsPic.bof then
Call NoPic("暂无图文新闻")
end if
%>
<table border="0" cellspacing="0" sellpadding="0" >
<%
do while not RsPic.eof
%>
<td align="center" valign="top" ><div style="FILTER: Shadow(color=#333333,direction=135); WIDTH: 200px; HEIGHT: 144px" align=center><a href="newsInfo.asp?id=<%response.write RsPic(0)%>"><img src="<%=RsPic("pic")%>"width="200" height="144" border="0"></a></div></td>
<%
RsPic.movenext
loop
RsPic.close
SET RsPic=Nothing
%>
</table>
</marquee></td>
</tr>
</table></td> 展开
<td colspan="20" rowspan="3" valign="top" bgcolor="#FFFFFF"><!--新闻图片-->
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="144" colspan="2" background="Images/gundongbg.gif"><marquee id="marqueeArea" behavior="scroll" scrollamount="2" scrolldelay="50" loop="infinite" direction="left" height="125" onMouseOver=this.stop(); onMouseOut=this.start()>
<%
set RsPic=server.createobject("adodb.recordset")
sql="select top 8 * from News where Ispic=1 ORDER BY id DESC"
RsPic.open sql,conn,1,1
if RsPic.eof or RsPic.bof then
Call NoPic("暂无图文新闻")
end if
%>
<table border="0" cellspacing="0" sellpadding="0" >
<%
do while not RsPic.eof
%>
<td align="center" valign="top" ><div style="FILTER: Shadow(color=#333333,direction=135); WIDTH: 200px; HEIGHT: 144px" align=center><a href="newsInfo.asp?id=<%response.write RsPic(0)%>"><img src="<%=RsPic("pic")%>"width="200" height="144" border="0"></a></div></td>
<%
RsPic.movenext
loop
RsPic.close
SET RsPic=Nothing
%>
</table>
</marquee></td>
</tr>
</table></td> 展开
3个回答
展开全部
<div id="demo" style="overflow:hidden;height:100%;width:100%;">
<table align=left cellpadding=0 cellspace=0 border=0 width=100%>
<tr><td id=demo1 valign=middle>
<table width=150 border=0 cellpadding=0 cellspacing="0" cellspace=0>
<tr>
<%
Set Rs_pic=Conn.execute("Select * from Pic order by id desc")
Do while Not Rs_pic.eof
%>
<td width=150>
<table width=150 border=0 cellpadding=0 cellspacing="0" cellspace=0>
<tr><td width=150 height=80 align=center valign=top><a href=showPic.asp?id=<%=Rs_pic("id")%> target="_blank"><img src="<%=Rs_pic("D_picture")%>" border=0 width=140 height=95></a></td>
</tr>
<tr><td height=20 class="kefu_tb_up_line" align=center><a href=showPic.asp?id=<%=Rs_pic("段颂id")%> target="_blank"><%=left(Rs_pic("升睁title"),5)%></a></td></tr>
</table>
</td>
<%
Rs_pic.movenext
Loop
Rs_pic.close
Set Rs_pic=nothing
%>
</tr></table>
</td>
<td id=demo2 valign=top></td></tr>
</table></div>
<script>
var speed=30
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>吵燃岁
=====================================
这是我自己程序中的,你修改一下Sql语句和字段名.
<table align=left cellpadding=0 cellspace=0 border=0 width=100%>
<tr><td id=demo1 valign=middle>
<table width=150 border=0 cellpadding=0 cellspacing="0" cellspace=0>
<tr>
<%
Set Rs_pic=Conn.execute("Select * from Pic order by id desc")
Do while Not Rs_pic.eof
%>
<td width=150>
<table width=150 border=0 cellpadding=0 cellspacing="0" cellspace=0>
<tr><td width=150 height=80 align=center valign=top><a href=showPic.asp?id=<%=Rs_pic("id")%> target="_blank"><img src="<%=Rs_pic("D_picture")%>" border=0 width=140 height=95></a></td>
</tr>
<tr><td height=20 class="kefu_tb_up_line" align=center><a href=showPic.asp?id=<%=Rs_pic("段颂id")%> target="_blank"><%=left(Rs_pic("升睁title"),5)%></a></td></tr>
</table>
</td>
<%
Rs_pic.movenext
Loop
Rs_pic.close
Set Rs_pic=nothing
%>
</tr></table>
</td>
<td id=demo2 valign=top></td></tr>
</table></div>
<script>
var speed=30
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>吵燃岁
=====================================
这是我自己程序中的,你修改一下Sql语句和字段名.
追问
呵呵,改好了!万分感谢!!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询