| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1061 人关注过本帖
标题:asp循环排列问题
只看楼主 加入收藏
ownnow
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-7-23
收藏
 问题点数:0 回复次数:5 
asp循环排列问题

一个搜索页,将搜索结果按照3行4列的方式排列,总是出问题,那位帮我看看, 下面是代码是1行1列的方式,帮我改下,谢谢!

<BODY>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="AutoNumber3" style="border-collapse: collapse">
<tr>
<td height="30">&nbsp;<img src="images/result.jpg" width="336" height="30">Key:<%=keyword%></b></td>
</tr>
<tr>
<td align="center"><%set rs=server.CreateObject("ADODB.RecordSet")
key_word="select * from product where " & findword & " order by UpdateTime DESC"
rs.Open key_word,conn,1,1
rs.PageSize=20
rs.CacheSize = RS.PageSize

for i=1 to rs.PageSize *( page-1)
if not rs.EOF then
rs.MoveNext
end if
next
if rs.EOF then
Response.Write "<font color=red>SORRY!Can't find.</font>"
else
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = MyPage
total = rs.RecordCount
end if
If Not rs.eof then
i = 0
do until rs.Eof or i = rs.PageSize
%>
<table width="135" height="119" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="109" colspan="2" align="center" valign="middle" background="images/prodbg.jpg"><a href="productdetail.asp?productid=<%=rs("productid")%>" target="_blank"><img border="0" src="<%=replace(rs("defaultpic"),"../../","")%>" width="113" height="85"></a></td>
</tr>
<tr>
<td width="135" height="10" align="center" valign="middle" class="style1"><a href="productdetail.asp?productid=<%=rs("productid")%>"><%=rs(filed)%> </a></td>
<td width="14" valign="middle"><img src="images/dot1.gif" width="11" height="9" /></td>
</tr>
</table>
<%
rs.MoveNext
i = i + 1
loop
%></td></tr>
<tr>
<td width="100%" height=30 align=center>Total:<font color="#0033FF"><%=total%></font>, It's <font color="#0033FF"><%=Mypage%>/<%=Maxpages%></font> Page,
<%
url="Result.asp?action="&request("action")&"&keyword=" & keyword
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1

if PageNextSize >1 then
PagePrev=PageShowSize*(PageNextSize-1)
Response.write "<a class=black href='" & Url & "&page=" & PagePrev & "' >Previous</a> "
Response.write "<a class=black href='" & Url & "&page=1'>Home</a> "
end if
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a class=black href='" & Url & "&page=" & Prev_Page & "'>Previous</a> "
end if

if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a class=black href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next

if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a class=black href='" & Url & "&page=" & Next_Page & "'>Next</A>"
end if

if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write " <A class=black href='" & Url & "&page=" & Pagetpage & "'>End</A>"
Response.write " <a class=black href='" & Url & "&page=" & PageNext & "'>Next</a>"
End if
end if
rs.close
%>
</td>
</tr>
</table>

搜索更多相关主题的帖子: 排列 asp align 搜索 
2007-07-23 12:45
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
什么三行四列啊!
直接做个三行四列的表格就可以了撒,然后再循环这个表格!

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2007-07-23 13:04
ownnow
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-7-23
收藏
得分:0 
回复:(gdk2006)什么三行四列啊!直接做个三行四列的...

我现在搜索出来的结果都是一个就换行,我想要的是没行放3个 后在换行, 没也放12个.在到下一页,是自动换的


人生如茶, 不过曾经如何浓烈,都将归于平淡......
2007-07-23 13:32
jiushini50
Rank: 1
等 级:新手上路
帖 子:119
专家分:0
注 册:2007-4-3
收藏
得分:0 
晕死啊,怎么和前面我看过的贴,一样的问题
2007-07-23 14:43
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 

****************************************** 请参考蓝色字体部分 *****************************

<BODY>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="AutoNumber3" style="border-collapse: collapse">
<tr>
<td height="30">&nbsp;<img src="images/result.jpg" width="336" height="30">Key:<%=keyword%></b></td>
</tr>
<tr>
<td align="center"><%set rs=server.CreateObject("ADODB.RecordSet")
key_word="select * from product where " & findword & " order by UpdateTime DESC"
rs.Open key_word,conn,1,1
rs.PageSize=20
rs.CacheSize = RS.PageSize

for i=1 to rs.PageSize *( page-1)
if not rs.EOF then
rs.MoveNext
end if
next
if rs.EOF then
Response.Write "<font color=red>SORRY!Can't find.</font>"
else
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = MyPage
total = rs.RecordCount
end if

%>
<table width="135" height="119" border="0" cellpadding="0" cellspacing="0">
<tr>
<% If Not rs.eof then
i = 0
do until rs.Eof or i = rs.PageSize %>
<td height="109" colspan="2" align="center" valign="middle" background="images/prodbg.jpg"><a href="productdetail.asp?productid=<%=rs("productid")%>" target="_blank"><img border="0" src="<%=replace(rs("defaultpic"),"../../","")%>" width="113" height="85"></a></td>
</tr>
<tr>
<td width="135" height="10" align="center" valign="middle" class="style1"><a href="productdetail.asp?productid=<%=rs("productid")%>"><%=rs(filed)%> </a></td>
<td width="14" valign="middle"><img src="images/dot1.gif" width="11" height="9" /></td>
<% i = i + 1
if i mod 4=0 then
response.write"</tr><tr>"
rs.MoveNext
loop
%>
</tr>
</table>
</td></tr>
<tr>
<td width="100%" height=30 align=center>Total:<font color="#0033FF"><%=total%></font>, It's <font color="#0033FF"><%=Mypage%>/<%=Maxpages%></font> Page,
<%
url="Result.asp?action="&request("action")&"&keyword=" & keyword
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1

if PageNextSize >1 then
PagePrev=PageShowSize*(PageNextSize-1)
Response.write "<a class=black href='" & Url & "&page=" & PagePrev & "' >Previous</a> "
Response.write "<a class=black href='" & Url & "&page=1'>Home</a> "
end if
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a class=black href='" & Url & "&page=" & Prev_Page & "'>Previous</a> "
end if

if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a class=black href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next

if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a class=black href='" & Url & "&page=" & Next_Page & "'>Next</A>"
end if

if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write " <A class=black href='" & Url & "&page=" & Pagetpage & "'>End</A>"
Response.write " <a class=black href='" & Url & "&page=" & PageNext & "'>Next</a>"
End if
end if
rs.close
%>
</td>
</tr>
</table>


生活的理想,就是为了理想的生活。
2007-07-23 14:45
ownnow
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-7-23
收藏
得分:0 
回复:(kira007)*********************************...

还是不行啊,提示错误:

错误类型:
Microsoft VBScript 编译器错误 (0x800A040E)
'loop' 语句缺少 'do'
/bestmate/search.asp, line 82
loop


人生如茶, 不过曾经如何浓烈,都将归于平淡......
2007-07-23 15:23
快速回复:asp循环排列问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.064059 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved