您的位置:首页 > 数据库

一个不错的从数据库读取图片的跑马灯代码

2010-06-04 16:01 519 查看
<TABLE cellSpacing=0 cellPadding=0 width="50%" align=center
border=0>
<TBODY>
<TR>
<TD colSpan=2 height=10></TD>
</TR>
<TR>
<TD colSpan=2 height=136 style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px">
<DIV id=demo style="OVERFLOW: hidden; WIDTH: 700px; HEIGHT: 190px">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD id=demo1 vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD>
<TABLE border=1 cellPadding=0 cellSpacing=0 bordercolor="#000000">
<TBODY>
<TR><td>
<%
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select top 20 * from 123 where tj=1",conn,1,1
Do while not rs.eof
%></td>
<td width="700" align="center"><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="130" align="center"><table border="0" cellpadding="0" cellspacing="1" >
<tr>
<td width="200" height="150" align="center" bgcolor="#FFFFFF"><a href='product1.asp?id=<%=rs("id")%>' target="_blank" title='<%=rs("title")%>'> <img border="0" height="150" src="<%if rs("pic1")="" then%>no.gif<%else%>admin/<%=rs("pic")%><%end if%>" width="200" alt="<%=rs("title")%>" align="center" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5" align="center"></td>
</tr>
<tr>
<td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="1" >
<tr>
<td height="27" align="center" bgcolor="#FFFFFF" style="font-size:12px"><%=rs("title")%></td>
</tr>
</table></td>
</tr>
</table> </td>
<%
rs.movenext
loop
rs.close
Set rs=nothing
%>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
<TD id=demo2
vAlign=top></TD>

</TR>
</TBODY></TABLE></DIV>
<SCRIPT>
var speed=10
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>
</TD>
<td width="10" ></td>
</TR>
<TR>
<TD width=38 bgColor=#F1F1F1 height=1></TD>
<TD width=300 bgColor=#F1F1F1 height=1></TD>
</TR>
<TR>
<TD colSpan=2
height=10></TD>
</TR>
</TBODY>
</TABLE>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐