日期:2014-05-17  浏览次数:21051 次

求从数据库中读取图片并从右到左滚动的代码
如题:
表名:products,图片字段名:hw_pic

------解决方案--------------------
以下是我正在用的,你对象修改一下字段即可。picwen=1的是意思是只用picwen字段为1的时候才从数据库中读出该数据,你要是没有限制的话可以不用的

C# code
<marquee scrollamount="2" height="131" width="697" onMouseOver="this.stop()" onMouseOut="this.start()"> 
<table> <tr> 
<% 
            set rs=server.createobject("adodb.recordset") 
            sql="select top 6 * from news where picwen=1 order by id desc" 
            RS.open sql,conn,1,1 
            if RS.bof and RS.eof then 
            Response.Write("暂时没有图片") 
            else 
            for i=1 to 6 
            %> 
<td> 
<table border="0" width="10%" id="table1"> 
    <tr> 
        <td> 
        <a href="show.asp?/<%= RS("id") %>.html" target="_blank" title="<%=RS("title")%>"> <img src="<%=RS("picurl")%>" border="0" width="140" height="130"> </a> 
</td> 
    </tr> 
    <tr> 
        <td> <p align="center"><a href="show.asp?id=<%=RS("id")%>" target="_blank" title="<%=RS("title")%>"> <%=RS("title")%> </a> </td> 
    </tr> 
</table> 
</td> 
<% 
            RS.movenext 
            next 
            set pic=nothing 
            RS.close 
            end if 
            %> 
</tr> </table></marquee>