| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1355 人关注过本帖
标题:怎么让这个显示一列产品的代码 两列显示
只看楼主 加入收藏
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
 问题点数:0 回复次数:9 
怎么让这个显示一列产品的代码 两列显示
<%set rs=server.createobject("adodb.recordset")
if leixing="big" then
rs.open "select * from wq_books where anclassid="&anclassid&" order by adddate desc",conn,1,1
elseif leixing="small" then
rs.open "select * from wq_books where anclassid="&anclassid&" and nclassid="&nclassid&" order by adddate desc",conn,1,1
elseif leixing="hot" then
rs.open "select * from wq_books order by chengjiaocount desc",conn,1,1
elseif leixing="tejia" then
rs.open "select * from wq_books where tejiabook=1 order by adddate desc",conn,1,1
elseif leixing="news" then
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
else
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
end if
if rs.recordcount=0 then
%>
<table width="370" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center>暂无商品</td>
</tr>
</table>
<%
else
rs.PageSize =10 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if

For i=1 To x
%>
<table width="100%" class="table-xia" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td width="20%" rowspan="4" class="table-you" align="center"><TABLE   width=100 height=100 cellSpacing=1 cellPadding=2 bgColor=#e1e1e1 border=0>
<TBODY>
<TR>
<TD width=100 height=100 bgColor=#ffffff align=center><%if rs("bookpic")="" then
response.write "<div align=center><a href=list.asp?id="&rs("bookid")&" ><img src=images/emptybook.gif width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("bookid")%> ><img src="<%=trim(rs("bookpic"))%>" width=100 border=0 height=100></a>
<%end if%>
</td>
</tr>
</tbody>
</table></td>
<td width="60%"><img src="images/ring01.gif"> <a href=list.asp?id=<%=rs("bookid")%> ><font color="#ff6600"><u>
<%
response.write trim(rs("bookname"))%>
</u></font></a> </td>
<td width="20%" rowspan="4" class="table-zuo"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center> 市场价:<%=trim(rs("shichangjia"))%> 元<br> <br>
</td>
</tr>
<tr>
<td align=center>  </td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><font color="#666666">
<%if len(trim(rs("bookcontent")))>100 then
response.write left(trim(rs("bookcontent")),98)&"..."
else
response.write trim(rs("bookcontent"))
end if%>
</font></td>
</tr>
</table>
<%rs.movenext
next
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
end if
rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 >" & vbCrLf )
Response.Write("<form method=get document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR >" & vbCrLf )
Response.Write("<TD align=center height=35>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首 页 " & vbCrLf)
Response.Write ("上一页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下一页 " & vbCrLf)
Response.Write ("尾 页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "种商品" & vbCrLf)
Response.Write(" 转到" & "<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT CLASS=go-wenbenkuang type=submit value=GO>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
搜索更多相关主题的帖子: order select anclassid 
2007-11-26 10:14
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
得分:0 
请高手们回答 谢谢!!!
2007-11-26 10:20
tianyu123
Rank: 1
等 级:新手上路
威 望:2
帖 子:576
专家分:0
注 册:2007-8-26
收藏
得分:0 
给你个思路
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<%
for i=1 to 11
if i mod 2=0 then
response.write"<td><table border='1'><tr>"
response.write"<td>"& i &"</td></tr></table></td>"
response.write"</tr><tr>"
else
response.write"<td><table border='1'><tr><td>"& i &"</td></tr></table></td>"
end if
next
%>
</tr>
</table>

改变一切,须从改变观念开始!
2007-11-26 13:00
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
得分:0 
谢谢! 如果能帮我改改上面的代码就好了  嘿嘿!!!!
2007-11-26 14:55
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
得分:0 
高手们谁还有更好的 方法啊! 谢谢了
2007-11-27 09:23
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
<%set rs=server.createobject("adodb.recordset")
if leixing="big" then
rs.open "select * from wq_books where anclassid="&anclassid&" order by adddate desc",conn,1,1
elseif leixing="small" then
rs.open "select * from wq_books where anclassid="&anclassid&" and nclassid="&nclassid&" order by adddate desc",conn,1,1
elseif leixing="hot" then
rs.open "select * from wq_books order by chengjiaocount desc",conn,1,1
elseif leixing="tejia" then
rs.open "select * from wq_books where tejiabook=1 order by adddate desc",conn,1,1
elseif leixing="news" then
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
else
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
end if
if rs.recordcount=0 then
%>
<table width="370" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center>暂无商品</td>
</tr>
</table>
<%
else
rs.PageSize =10 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if

%>
<table width="100%" class="table-xia" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<% n=0
For i=1 To x%>
<td width="20%" rowspan="4" class="table-you" align="center"><TABLE   width=100 height=100 cellSpacing=1 cellPadding=2 bgColor=#e1e1e1 border=0>
<TBODY>
<TR>
<TD width=100 height=100 bgColor=#ffffff align=center><%if rs("bookpic")="" then
response.write "<div align=center><a href=list.asp?id="&rs("bookid")&" ><img src=images/emptybook.gif width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("bookid")%> ><img src="<%=trim(rs("bookpic"))%>" width=100 border=0 height=100></a>
<%end if%>
</td>
</tr>
</tbody>
</table></td>
<td width="60%"><img src="images/ring01.gif"> <a href=list.asp?id=<%=rs("bookid")%> ><font color="#ff6600"><u>
<%
response.write trim(rs("bookname"))%>
</u></font></a> </td>
<td width="20%" rowspan="4" class="table-zuo"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center> 市场价:<%=trim(rs("shichangjia"))%> 元<br> <br>
</td>
</tr>
<tr>
<td align=center>  </td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><font color="#666666">
<%if len(trim(rs("bookcontent")))>100 then
response.write left(trim(rs("bookcontent")),98)&"..."
else
response.write trim(rs("bookcontent"))
end if%>
</font></td>
<% n=n+1
if n mod 2=0 then
response.write "</tr><tr>"
end if
rs.movenext
next
%>
</tr>
</table>
<%call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
end if
rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 >" & vbCrLf )
Response.Write("<form method=get document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR >" & vbCrLf )
Response.Write("<TD align=center height=35>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首 页 " & vbCrLf)
Response.Write ("上一页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下一页 " & vbCrLf)
Response.Write ("尾 页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "种商品" & vbCrLf)
Response.Write(" 转到" & "<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT CLASS=go-wenbenkuang type=submit value=GO>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>

生活的理想,就是为了理想的生活。
2007-11-27 09:58
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
得分:0 
这个代码放上去 下面的翻页问题到是解决了, 看产品显示的 好象乱套了啊
2007-11-27 15:56
潇寒
Rank: 1
等 级:禁止访问
帖 子:157
专家分:0
注 册:2006-10-18
收藏
得分:0 
哥们儿,我想你应当考虑用下DIV 呵呵,我一般写商城、产品列表的时候都用这个标签,这个东西很好用的,想让它怎么显示都可以,只用调它的宽度就可以了。很方便!!~~

[url=http://www..cn] 亚洲数据[/url]
2007-11-27 16:04
asoho
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-11-26
收藏
得分:0 
嘿嘿 可问题就是  你说的这个DIV 我不会啊
2007-11-27 16:52
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
回复楼主,用六楼代码之所以会乱套了,是因为循环表格为 3行3列 ,而输出换行部分为 1行一列,所以显示不正常,现在把在六楼时所发的代码修改更正下,便能正常显示了(紫红色代码为更正代码)。

******************  更正 在 6楼 时所发的 代码 **********************************
<%set rs=server.createobject("adodb.recordset")
if leixing="big" then
rs.open "select * from wq_books where anclassid="&anclassid&" order by adddate desc",conn,1,1
elseif leixing="small" then
rs.open "select * from wq_books where anclassid="&anclassid&" and nclassid="&nclassid&" order by adddate desc",conn,1,1
elseif leixing="hot" then
rs.open "select * from wq_books order by chengjiaocount desc",conn,1,1
elseif leixing="tejia" then
rs.open "select * from wq_books where tejiabook=1 order by adddate desc",conn,1,1
elseif leixing="news" then
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
else
rs.open "select * from wq_books where newsbook=1 order by adddate desc",conn,1,1
end if
if rs.recordcount=0 then
%>
<table width="370" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center>暂无商品</td>
</tr>
</table>
<%
else
rs.PageSize =10 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if

%>
<table width="100%" class="table-xia" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<% n=0
For i=1 To x%>
<td width="20%" rowspan="4" class="table-you" align="center"><TABLE   width=100 height=100 cellSpacing=1 cellPadding=2 bgColor=#e1e1e1 border=0>
<TBODY>
<TR>
<TD width=100 height=100 bgColor=#ffffff align=center><%if rs("bookpic")="" then
response.write "<div align=center><a href=list.asp?id="&rs("bookid")&" ><img src=images/emptybook.gif width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("bookid")%> ><img src="<%=trim(rs("bookpic"))%>" width=100 border=0 height=100></a>
<%end if%>
</td>
</tr>
</tbody>
</table></td>
<td width="60%"><img src="images/ring01.gif"> <a href=list.asp?id=<%=rs("bookid")%> ><font color="#ff6600"><u>
<%
response.write trim(rs("bookname"))%>
</u></font></a> </td>
<td width="20%" rowspan="4" class="table-zuo"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center> 市场价:<%=trim(rs("shichangjia"))%> 元<br> <br>
</td>
</tr>
<tr>
<td align=center>  </td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><font color="#666666">
<%if len(trim(rs("bookcontent")))>100 then
response.write left(trim(rs("bookcontent")),98)&"..."
else
response.write trim(rs("bookcontent"))
end if%>
</font></td>
<% n=n+1
if n mod 2=0 then
response.write "</tr><tr><td height='1'  colspan='6'  bgcolor='#CCCCCC'><img name='' src='' width='1' height='1' alt=''></td></tr><tr>"
end if
rs.movenext
next
%>
</tr>
</table>
<%call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
end if
rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 >" & vbCrLf )
Response.Write("<form method=get document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR >" & vbCrLf )
Response.Write("<TD align=center height=35>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首 页 " & vbCrLf)
Response.Write ("上一页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下一页 " & vbCrLf)
Response.Write ("尾 页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "种商品" & vbCrLf)
Response.Write(" 转到" & "<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT CLASS=go-wenbenkuang type=submit value=GO>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>

[[italic] 本帖最后由 kira007 于 2007-11-29 12:02 编辑 [/italic]]

生活的理想,就是为了理想的生活。
2007-11-29 11:58
快速回复:怎么让这个显示一列产品的代码 两列显示
数据加载中...
 
   



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

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