网站的产品列表模块如何九宫格显示?
怎么样修改才能将我的产品列表改成五行四列的显示?代码如下:
<%
dim aid
aid = request("aid")
url = ""
where = ""
if aid <> "" then
call CheckNum(aid)
url="&aid="&aid
where = " and A.aid = "&aid
end if
Const PAGESIZE=6
Const PARTSIZE=10
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
prosql = "select A.title,A.id,A.aid,A.propic,B.aname from tsm_pro A,tsm_probc B where A.aid = B.aid "&where&" order by id desc"
%>
<SCRIPT language=JavaScript>
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>=100/100){
if(image.width>100){
ImgD.width=100;
ImgD.height=(image.height*100)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>100){
ImgD.height=100;
ImgD.width=(image.width*100)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll")
e.checked = form.chkAll.checked;
}
}
//-->
</SCRIPT>
<table width="943" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="32" colspan="2" background="images/dh-m.jpg"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" class="wz">您现在的位置:首页 <font face="webdings">8</font></span> 产品列表</td>
</tr>
</table></td>
</tr>
</table>
<table width="943" border="0" align="center">
<tr>
<td rowspan="2" valign="top"><!--左边-->
<!--#include file="leftproduct.asp"--></td>
</tr>
<tr>
<td valign="top"><table width="725" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr><td height="28" background="images/table.jpg" class="wz">产品列表</td></tr>
<tr>
<td height="14" colspan="3" background="images/txt-top.jpg"></td>
</tr>
<tr>
<td colspan="3" valign="top" background="images/txt-midd.jpg">
<FORM name=Inquire action=Payment.asp method=post target=_blank>
<table width="97%" border="0" align="center" class="A1">
<tr>
<td align="left" valign="top" class="A1">
<%
set rs = server.CreateObject("adodb.recordset")
rs.open prosql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
%>
<%if RS.EOF then
else
if recordcount > 0 then RS.AbsolutePage = page
for i = 1 to PAGESIZE
if RS.EOF then exit for
%>
<table width="8%" border="0">
<tr>
<td align="center"><a
href="ProductShow.asp?ID=<%=rs("id")%>"><img style="BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-COLOR: #cccccc; BORDER-TOP-COLOR: #cccccc; BORDER-RIGHT-COLOR: #cccccc" height=32 src="<%=rs("propic")%>" width=32
onload=javascript:DrawImage(this);></a></td>
</tr>
<tr>
<td align="center"><a
href="ProductShow.asp?ID=<%=rs("id")%>"><%=rs("title")%></a></td>
</tr>
</table>
<br>
<%
RS.MoveNext()
if RS.EOF then exit for
next
end if
%></td>
</tr>
</table></FORM>
<TABLE align=center>
<TR>
<TD><!--#include file="page.asp"--></TD>
</TR>
</TABLE>
<p> </p></td>
</tr>
<tr>
<td height="16" colspan="3" background="images/txt-foot.jpg"></td>
</tr>
</table></td>
</tr>
</table>
[解决办法]
<%dim i_all,i_end,iii_all=13 '总数量'生成5行4列表格,自动补齐缺少的格子Response.write "<table width=200 border=1><tr>"for i=1 to i_all Response.write "<td>"&i&"</td>" if i mod 4=0 then Response.write "</tr><tr>" end if if i=i_all then i_end=i_all mod 4 if i_end>0 then for ii=1 to (4-i_end) Response.write "<td>空白</td>" next end if end if if i>=20 then exit for '超出20个格式就结束运行nextResponse.write "</tr></table>"%>