如:我想在页面上一共显示12张图,一行显示4张,一共显示3行!
看红色的地方!
PageNum = 12 '这里是控制图片为数量的
RsPage = RsNum \ PageNum
RsMod = RsNum Mod PageNum
IF RsMod > 0 Then RsPage = RsPage + 1
IF PageNo > RsPage Then PageNo = RsPage
LoopNo = RsNum - PageNum*PageNo
IF LoopNo < 0 Then LoopNo = 0
IF PageNo = RsPage AND RsMod > 0 Then
LoopNum = RsMod
Else
LoopNum = PageNum
End IF
IF RsNum > 0 Then
Set Rs=Conn.Execute("SELECT id,moviename,movieclass_id,moviearea,moviegrade,movielong,movieplayer,pic,looknum,addtime FROM hy_movie WHERE movieclass_id="&movieclass_id)
Rs.Move(LoopNo)
For N = 1 To LoopNum
IF Rs(7)<>"" then
nopic="<a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank""><img src=""pic/"&Rs(7)&""" width=""132"" height=""95"" border=""0""></a>"
Else
nopic="<a href=""showmovie3.asp?id="&Rs(0)&""" target=""_blank""><img src=""img/nopic.gif"" width=""132"" height=""95"" border=""0""></a>"
End IF
ListString="<td valign=""top""><table width=""90%"" height=""145"" border=""0"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#F7F6EC"" class=""border"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""170"" height=""143"" align=""center"">"&Chr(10)&_
"<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""6"">"&Chr(10)&_
" <tr>"&Chr(10)&_
"<td align=""center"">"&nopic&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td align=""left""><strong>主演:<br>"&Chr(10)&_
"</strong>"&Rs(6)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"<td width=""1"" background=""image/type_line.gif""></td>"&Chr(10)&_
"<td><table width=""96%"" height=""125"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#FFFFFF"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""25""><table width=""98%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#DEE7B4"" class=""border2"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""10%"" height=""23"" align=""center""><img src=""image/line_4.gif"" width=""5"" height=""5""> <span class=""text_green""></span></td>"&Chr(10)&_
"<td width=""90%""><span class=""text_green""><strong><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&Rs(1)&"</a></strong></span></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""100""><table width=""96%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""41%"" height=""20""><strong>产地: </strong></td>"&Chr(10)&_
"<td width=""59%"" height=""20"">"&Rs(3)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong>推荐级别:</strong> </td>"&Chr(10)&_
"<td height=""20"">"&Rs(4)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong>浏览: </strong></td>"&Chr(10)&_
"<td height=""20"">"&Rs(8)&"次</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong> 加入时间:</strong></td>"&Chr(10)&_
"<td height=""20"">"&Year(Rs(9))&"-"&Month(Rs(9))&"-"&Day(Rs(9))&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20"" colspan=""2""><div align=""right""><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank""><img src=""image/lookit.gif"" width=""36"" height=""16"" border=""0""></a></div></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&ListString&Chr(10)
if N Mod 4 = 0 then
ListString = ListString & "<br>"
end if
t=t+1
IF t mod 2 = 0 then ListString=ListString&"</tr><tr><td height=""10""> </td><td> </td></tr><tr>"
Rs.MoveNext
Next
<!--#include file="Conn.asp"-->
<%
Dim Rs,movieclass_id,movieclassname,picssss
Dim ListStringClass'本类别推荐
Dim hitListString,hitListStringone,t'点击排行榜
Dim ListString'电影
Dim movieareaID,typeid,keyword
movieclass_id=Request.QueryString("movieclass_id")
IF movieclass_id="" OR Not IsNumeric(movieclass_id) Then
Response.write("<script>alert('类别参数不正确!!');history.back();</script>;")
Response.End
End IF
OpenConn
'///////////////类别名movieclassname///////////////////////
Set Rs=Conn.Execute("SELECT id,movieclassname FROM hy_movieclass WHERE id="&movieclass_id)
IF Rs.eof or Rs.bof then Response.Redirect("error.asp?ErrID=4")
movieclassname=Rs(1)
Rs.close
Set Rs=nothing
'//////////////ListStringClass'本类别推荐////////////
Set Rs=Conn.Execute("SELECT TOP 5 id,moviename,movieclass_id,pic5 FROM hy_movie WHERE isone=true and pic<>Null and movieclass_id="&movieclass_id&" ORDER BY id DESC")
While Not Rs.Eof
IF Rs(3)<>"" then
picssss="<img src=""pic/"&Rs(3)&""" width=""76"" height=""110"" border=""0"">"
Else
picssss="<img src=""img/nopic.gif"" width=""76"" height=""110"" border=""0"">"
End IF
ListStringClass=ListStringClass&"<td height=""136""><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&picssss&"</a><br>"&Chr(10)&_
"<br><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&Rs(1)&"</a></td>"&Chr(10)
Rs.MoveNext
Wend
Rs.Close
Set Rs=nothing
IF ListStringClass="" then ListStringClass="<td>暂无影片</td>"
'//////////////////点击排行榜hitListString///////////////////////
Set Rs=Conn.Execute("SELECT TOP 1 id,moviename,looknum,pic,movieplayer FROM hy_movie ORDER BY looknum DESC")
IF Rs(3)<>"" then
picssss="<img src=""pic/"&Rs(3)&""" width=""57"" height=""53"" border=""0"">"
Else
picssss="<img src=""img/nopic.gif"" width=""57"" height=""53"" border=""0"">"
End IF
hitListStringone="<table width=""98%"" height=""80"" border=""0"" align=""center"" cellpadding=""6"" cellspacing=""0"" bgcolor=""#FFFFFF"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""34%"" align=""center""><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&picssss&"</td>"&Chr(10)&_
"<td><img src=""image/numberpic/n_1.gif"" width=""11"" height=""10""> <a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&Rs(1)&"</a><br>"&Chr(10)&_
"<br>"&Chr(10)&_
"主演:"&Rs(4)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table>"&Chr(10)
Rs.Close
Set Rs=nothing
Dim i
t=0
i=0
Set Rs=Conn.Execute("SELECT TOP 7 id,moviename,looknum,addtime,movieplayer FROM hy_movie ORDER BY looknum DESC")
While Not Rs.Eof
t=t+1
IF t<>1 then
i=i+1
hitListString=hitListString&"<td height=""20"" align=""right""><img src=""image/numberpic/n_"&t&".gif"" width=""11"" height=""10""></td>"&Chr(10)&_
"<td height=""20""> <a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&cutstr(Rs(1),8)&"</a></td>"
IF i mod 2 = 0 then hitListString=hitListString&"</tr><tr>"
End IF
Rs.MoveNext
Wend
Rs.Close
Set Rs=Nothing
'////////////电影ListString////////////////////
t=0
Dim LoopNo,LoopNum
Dim RsNum,RsPage,RsMod,PageNum,PageNo,N
Dim nopic
PageNo = Request.QueryString("PageNo")
IF PageNo="" OR Not IsNumeric(PageNo) Then PageNo = 1
PageNo = INT(PageNo)
IF PageNo < 1 Then PageNo = 1
Rs = Conn.Execute("Select Count(0) From hy_movie WHERE movieclass_id="&movieclass_id)
RsNum = Rs(0)
Set Rs = Nothing
PageNum = 12 '这里是控制图片为数量的
RsPage = RsNum \ PageNum
RsMod = RsNum Mod PageNum
IF RsMod > 0 Then RsPage = RsPage + 1
IF PageNo > RsPage Then PageNo = RsPage
LoopNo = RsNum - PageNum*PageNo
IF LoopNo < 0 Then LoopNo = 0
IF PageNo = RsPage AND RsMod > 0 Then
LoopNum = RsMod
Else
LoopNum = PageNum
End IF
IF RsNum > 0 Then
Set Rs=Conn.Execute("SELECT id,moviename,movieclass_id,moviearea,moviegrade,movielong,movieplayer,pic,looknum,addtime FROM hy_movie WHERE movieclass_id="&movieclass_id)
Rs.Move(LoopNo)
For N = 1 To LoopNum
IF Rs(7)<>"" then
nopic="<a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank""><img src=""pic/"&Rs(7)&""" width=""132"" height=""95"" border=""0""></a>"
Else
nopic="<a href=""showmovie3.asp?id="&Rs(0)&""" target=""_blank""><img src=""img/nopic.gif"" width=""132"" height=""95"" border=""0""></a>"
End IF
if N-1 Mod 4 = 0 then
ListString = ListString & "<tr>"
end if
ListString="<td valign=""top""><table width=""90%"" height=""145"" border=""0"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#F7F6EC"" class=""border"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""170"" height=""143"" align=""center"">"&Chr(10)&_
"<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""6"">"&Chr(10)&_
" <tr>"&Chr(10)&_
"<td align=""center"">"&nopic&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td align=""left""><strong>主演:<br>"&Chr(10)&_
"</strong>"&Rs(6)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"<td width=""1"" background=""image/type_line.gif""></td>"&Chr(10)&_
"<td><table width=""96%"" height=""125"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#FFFFFF"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""25""><table width=""98%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#DEE7B4"" class=""border2"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""10%"" height=""23"" align=""center""><img src=""image/line_4.gif"" width=""5"" height=""5""> <span class=""text_green""></span></td>"&Chr(10)&_
"<td width=""90%""><span class=""text_green""><strong><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank"">"&Rs(1)&"</a></strong></span></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""100""><table width=""96%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td width=""41%"" height=""20""><strong>产地: </strong></td>"&Chr(10)&_
"<td width=""59%"" height=""20"">"&Rs(3)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong>推荐级别:</strong> </td>"&Chr(10)&_
"<td height=""20"">"&Rs(4)&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong>浏览: </strong></td>"&Chr(10)&_
"<td height=""20"">"&Rs(8)&"次</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20""><strong> 加入时间:</strong></td>"&Chr(10)&_
"<td height=""20"">"&Year(Rs(9))&"-"&Month(Rs(9))&"-"&Day(Rs(9))&"</td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"<tr>"&Chr(10)&_
"<td height=""20"" colspan=""2""><div align=""right""><a href=""showmovie.asp?id="&Rs(0)&""" target=""_blank""><img src=""image/lookit.gif"" width=""36"" height=""16"" border=""0""></a></div></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&Chr(10)&_
"</tr>"&Chr(10)&_
"</table></td>"&ListString&Chr(10)
if N-1 Mod 4 = 0 then
ListString = ListString & "</tr>"
end if
t=t+1
IF t mod 2 = 0 then ListString=ListString&"</tr><tr><td height=""10""> </td><td> </td></tr><tr>"
Rs.MoveNext
Next
Rs.Close
Set Rs=Nothing
end if
IF ListString="" then ListString="<td>暂无影片</td>"
CloseConn
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电影</title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<!--#include file="top.asp"-->
<table width="986" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7" valign="top"> </td>
<td width="790" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><!--#include file="seach.asp"--></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
<td height="3"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F8F7EF">
<tr bgcolor="#FFFFFF">
<td width="510" height="40"><table width="100%" height="124" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="405" height="29" bgcolor="#8EA233"><img src="image/type_good.gif" width="115" height="29"></td>
</tr>
<tr>
<td height="150" bgcolor="#DEE7B4"><table width="98%" height="136" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<%=ListStringClass%>
</tr>
</table></td>
</tr>
</table></td>
<td valign="top"><table width="261" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="image/type_paihang.gif" width="261" height="5"></td>
</tr>
<tr>
<td valign="top" background="image/type_paihang_bg.gif"><table width="98%" height="24" border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#DEE7B4" class="border2">
<tr>
<td>点击排行榜</td>
</tr>
</table>
<%=hitListStringone%> </td>
</tr>
<tr>
<td align="center" background="image/type_paihang_bg.gif">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%=hitListString%>
</tr>
<tr><td height="10"> </td><td> </td></tr>
</table></td>
</tr>
<tr>
<td><img src="image/type_paihang_end.gif" width="261" height="10"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="32"><img src="image/line_title2.gif" width="5" height="38"></td>
<td width="86" valign="bottom"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20"><img src="image/new_movie2.gif" width="49" height="7"></td>
</tr>
<tr>
<td ><a href="#" class="yellow"><%=movieclassname%></a></td>
</tr>
</table></td>
<td width="672" valign="bottom" background="image/line_bg.gif" class="bgno2"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="30"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td width="64"><img src="image/page.gif" width="38" height="18"></td><td width="381"><font color="#000000"><%="当前 <strong>"&PageNo&"</strong> /<strong>"&RsPage&"</strong>页 | 每页:<strong>"&PageNum&"</strong>条 | 共:<strong>"&RsNum&"</strong> 条/<strong>"&RsPage&"</strong>页 ]"%></font></td>
<td width="225" align="right">
<%
IF PageNo > 1 Then
Response.Write(" <a href='?PageNo=1&movieclass_id="&movieclass_id&"'>[首页]</a><a href='?PageNo="&PageNo-1&"&movieclass_id="&movieclass_id&"'>[上页]</a>")
End IF
IF PageNo < RsPage Then
Response.Write(" <a href='?PageNo="&PageNo+1&"&movieclass_id="&movieclass_id&"'>[下页]</a><a href='?PageNo="&RsPage&"&movieclass_id="&movieclass_id&"'>[末页]</a>")
End IF
%>
</td>
<td width="120" align="right">转到
<%
Dim u,uListString
For u=1 to RsPage
IF PageNo=u then
uListString=uListString&"<option value='movielist.asp?PageNo="&u&"&movieclass_id="&movieclass_id&"' selected>第"&u&"页</option>"
Else
uListString=uListString&"<option value='movielist.asp?PageNo="&u&"&movieclass_id="&movieclass_id&"'>第"&u&"页</option>"
End IF
next
%>
<select name="select1" onChange="MM_jumpMenu('parent',this,0)" style="color:#000000;font-size: 9pt">
<%=uListString%>
</select>
页 </font></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<%=ListString%>
<tr>
<td height="10"><!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td width="64"><img src="image/page.gif" width="38" height="18"></td><td width="381"><font color="#000000"><%="当前 <strong>"&PageNo&"</strong> /<strong>"&RsPage&"</strong>页 | 每页:<strong>"&PageNum&"</strong>条 | 共:<strong>"&RsNum&"</strong> 条/<strong>"&RsPage&"</strong>页 ]"%></font></td>
<td width="225" align="right">
<%
IF PageNo > 1 Then
Response.Write(" <a href='?PageNo=1&movieclass_id="&movieclass_id&"'>[首页]</a><a href='?PageNo="&PageNo-1&"&movieclass_id="&movieclass_id&"'>[上页]</a>")
End IF
IF PageNo < RsPage Then
Response.Write(" <a href='?PageNo="&PageNo+1&"&movieclass_id="&movieclass_id&"'>[下页]</a><a href='?PageNo="&RsPage&"&movieclass_id="&movieclass_id&"'>[末页]</a>")
End IF
%>
</td>
<td width="120" align="right">转到
<select name="select1" onChange="MM_jumpMenu('parent',this,0)" style="color:#000000;font-size: 9pt">
<%=uListString%>
</select>
页 </font></td>
</tr>
</table></td>
<td valign="top" bgcolor="#F8EBC4"><!--#include file="news.asp"--><br>
<!--#include file="guanggao.asp"--><br>
<!--#include file="moviecount.asp"-->
<p> </p></td>
</tr>
</table>
<!--#include file="foot.asp"-->
</body>
</html>
[此贴子已经被作者于2005-11-26 20:27:28编辑过]