asp网页 图片从数据库读取,并横向从右往左滚动的代码怎么写?

asp网页 图片从数据库读取,并横向从右往左滚动的代码怎么写?,第1张

<div id="demo" style="overflow:hiddenwidth:700px">

<table border=0 align=center cellpadding=1 cellspacing=1 cellspace=0 >

<tr><td valign=top bgcolor=ffffff id="marquePic1">

<table width='100%' border='0' cellspacing='0'><tr>

<% set rs= Server.CreateObject("ADODB.RecordSet")

sql="select top 8 topid,photoname,bigpic from zhi_rui_g_po order by topid desc" '数据表及调用的总图片

rs.open sql,conn,1,1

if rs.eof and rs.bof then

response.Write("暂无信息!")

else

i=0

do while not rs.eof%>

<td align="center">

<a href="xxxx.asp?id=<%=rs(0)%>" title="<%=rs(1)%>"><img width="50" height="50" src="<%=rs(2)%>"><br><br><%=left(rs(1),8)%></a></td>

<%

i=i+1

rs.movenext

if i mod 4=0 then response.write ("</tr>")'每行显示的图片数

loop

end if

rs.close

set rs=nothing%>

</table>

</td><td id=marquePic2 valign=top></td></tr>

</table></div>

<script type="text/javascript">

var speed=50

marquePic2.innerHTML=marquePic1.innerHTML

function Marquee(){

if(demo.scrollLeft>=marquePic1.scrollWidth){

demo.scrollLeft=0

}else{

demo.scrollLeft++

}

}

var MyMar=setInterval(Marquee,speed)

demo.onmouseover=function() {clearInterval(MyMar)}

demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}

</script>

</div>

<TABLE width=900 height="40" border=0 align="center" cellPadding=0 cellSpacing=0>

<TBODY>

<TR>

<TD valign="middle" bgcolor="#FFFFFF">

<div id=demo style="overflow:hiddenheight:40pxwidth:900px">

<table border="0" cellspacing="0" cellpadding="0" width="898">

<tr>

<td width="603" height="40" align="left" valign="middle" id=demo1>

<!--第二个表-->

<table border="0" cellpadding="0" cellspacing="0">

<% dim i %>

<tr>

<%

strsql="select * from FriendSite where LinkType=1 order by ID desc"

set rs=server.createobject("ADODB.recordset")

rs.open strsql,conn,3,2

do until rs.eof

%>

<td>

<table border="0" cellpadding="0" cellspacing="0"><!--显示照片-->

<tr>

<td width="110" align="center">

<div id="photo"><a href="<%=rs("SiteUrl")%>" target="_blank"><img src="<%=rs("LogoUrl") %>" border="0" height="35" /></a></div></td>

</tr>

</table>

</td>

<%

rs.movenext

loop

i=i+1

if i mod 6=0 then

%> </tr>

<%

end if

rs.close

%>

</table>

<!--第二个表结束--> </td>

<td width="295" id=demo2></td>

</tr>

</table>

</div>

<!--第一个表结束-->

<script language="javascript">

var speed=10

demo2.innerHTML=demo1.innerHTML

demo.scrollLeft=demo.scrollWidth

function Marquee()

{

if(demo.scrollLeft<=0)

demo.scrollLeft+=demo2.offsetWidth

else{

demo.scrollLeft--

}

}

var MyMar=setInterval(Marquee,speed)

demo.onmouseover=function(){clearInterval(MyMar)}

demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)}

</script>

</TD>

</TR></TBODY></TABLE></BODY></HTML>

<%

conn.close

%>


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

原文地址: http://outofmemory.cn/sjk/6779453.html

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

发表评论

登录后才能评论

评论列表(0条)

保存