我对ASP不是很懂,但是现在要修改一个商品的页面
以前它是每行显示四个商品 总共两行(8个商品)多的不显示
现在我想让它显示四行 (16个商品)多的则转入下一页
原代码如下:<META http-equiv=Content-Type content="text/html; charset=gb2312">
<% set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 id,name,pic,price1,price2,adddate,stock from product where stock >= 0 order by adddate desc",conn,1,1
if rs.eof and rs.bof then
response.write "<table CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=""100%""><tr><td align=center>对不起,请您先到后台添加商品!</td></tr></table>"
else
%>
<TABLE cellSpacing=0 cellPadding=0 width=564 align=center border=0>
<TBODY>
<TR>
<% dim j
j=0
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr><% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=4 then exit do
loop %> </TR>
<%
rs.absoluteposition=5
j=5 %>
<TR>
<%
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr>
<% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=9 then exit do
loop %> </TR>
<%
rs.close
set rs= nothing %>
</TBODY></TABLE>
<% end if %>
最好附上中文说明!我不是很懂! 谢谢各位了
參考答案:....
<% dim j
j=0
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr><% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=4 then exit do
loop %> </TR>
<%
rs.absoluteposition=5
j=5 %>
<TR>
<%
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr>
<% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=9 then exit do
loop %> </TR>
<%
rs.absoluteposition=9
j=9 %>
<TR>
<%
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr>
<% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=13 then exit do
loop %> </TR>
<%
rs.absoluteposition=13 '第四行记录从第十三条记录开始读取
j=13 %>
<TR>
<%
do while not rs.eof %>
<TD width=140 border="0" align=center>
<TABLE cellSpacing=0 cellPadding=0 width="140" border=0>
<TBODY>
<tr><td height="140" width="200%" align="center" background="images/136.jpg">
<A HREF=product.asp?id=<%=rs("id")%> TARGET=_blank>
<IMG ALT=上市日期<%=trim(rs("adddate"))%> SRC=<%if trim(rs("pic"))="" then %>
images/emptybook.gif
<% else %>
<% = trim(rs("pic")) %>
<% end if%> BORDER=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></A></td></tr>
<% if rs("stock") > 0 then %>
<% else %>
<% end if %>
</TBODY>
</TABLE></TD>
<% rs.movenext
j=j+1
if rs.eof then
exit do
end if
if j>=17 then exit do '当J大于16条记录时退出循环
loop %> </TR>
<%
rs.close
set rs= nothing %>
</TBODY></TABLE>
<% end if %>
....
事实上你这种显示还可以用另外一种形式表示的