把电影数据库中的所有电影按类别每行三列的方式显示在一页中。
<TABLE border="0" cellpadding="0" cellspacing="0" bordercolor="#39599C" bordercolorlight="#000000" bordercolordark="#39599C" width="573" height="429" bgcolor="#39599C">
<tr>
<td height="19" valign="top"><font color="#000000">您现在的位置:</font><font color="#000000"><a class="top" href="<%=application("url")%>"><%=application("home")%></a>-<a class="bianjie" href="<%=application("urls")%>"><%=application("homes")%></a>-全部影片 </font></td>
</tr>
<TR>
<TD valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
'显示类型部分代码
dim rstype,sql
sql="select typeid,type from type"
set rstype=server.CreateObject("ADODB.Recordset")
rstype.open sql,conn,1,1
do while not rstype.eof
response.Write("<TR bordercolor='#39599C' bordercolorlight='#000000' bordercolordark='#39599C' bgcolor='#39599C'>")
response.write(" <TD height='19' bgcolor='#6699CC' align='center'><font color='#FFFF00' size='4'>" )
response.write rstype("type") '电影类型名称
response.write(" </font></TD></TR> ")
response.write(" <TR bordercolor='#39599C' bordercolorlight='#000000' bordercolordark='#39599C' bgcolor='#39599C'> ")
response.write(" <TD height='19'> ")
response.write(" <table width='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#39599C' bordercolorlight='#000000' bordercolordark='#39599C'> ")
dim rs,strSQL
strSQL =" SELECT * FROM film where typeid= " &rstype("typeid")&" order by dateandtime desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSQL,Conn,1,1
countrs=rs.recordcount
all=1
do while not rs.eof
response.write(" <tr> ")
for a = 1 to 3
if rs.eof then '判断是否到了查询表结尾,如果到了结尾,则显示空单元格
response.write(" <td><font color=red> </font></td> ")
else
daynum=date() -rs("dateandtime")
hitsnum=rs("hits")
with response
.write(" <td width='33%'><a href=# onClick=""javascript:window.open('list.asp?id= ")
.write rs("id")
.write ("','list','toolbar=no,resizable=no,scrollbars=yes,width=480,height=331')""> ")
.write (" </a><a href=# onClick=""javascript:window.open('list.asp?id= ")
.write rs("id")
.write (" ','list','toolbar=no,resizable=no,scrollbars=yes,width=480,height=331')""><font color='#000000'> ")
'点击率高的电影黄色显示
if (hitsnum>hits) then
.write (" <font color='#FFFF00'> ")
.write rs("title")
.write (" </font> ")
else
.write rs("title")
end if
.write (" </font></a> ")
.write (" </td> ")
end with
rs.movenext
all=all+1
end if
next
response.write (" </tr> ")
loop
response.write (" </table> ")
rs.close
response.write (" </tr> ")
rstype.movenext
loop
rstype.close
%>
</table>
本文地址:http://com.8s8s.com/it/it7649.htm