设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 89|回复: 9
打印 上一主题 下一主题

怎么让这个显示一列产品的代码 两列显示

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-9 02:43:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<%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
%>
2#
发表于 2010-1-9 02:43:07 | 只看该作者
这个代码放上去 下面的翻页问题到是解决了, 看产品显示的 好象乱套了啊
回复 支持 反对

使用道具 举报

3#
发表于 2010-1-9 02:43:11 | 只看该作者
谢谢! 如果能帮我改改上面的代码就好了  嘿嘿!!!!
回复 支持 反对

使用道具 举报

4#
发表于 2010-1-9 02:43:14 | 只看该作者
请高手们回答 谢谢!!!
回复 支持 反对

使用道具 举报

5#
发表于 2010-1-9 02:43:18 | 只看该作者
哥们儿,我想你应当考虑用下DIV 呵呵,我一般写商城、产品列表的时候都用这个标签,这个东西很好用的,想让它怎么显示都可以,只用调它的宽度就可以了。很方便!!~~
回复 支持 反对

使用道具 举报

6#
发表于 2010-1-9 02:43:22 | 只看该作者
高手们谁还有更好的 方法啊! 谢谢了
回复 支持 反对

使用道具 举报

7#
发表于 2010-1-9 02:43:27 | 只看该作者
回复楼主,用六楼代码之所以会乱套了,是因为循环表格为 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]]
回复 支持 反对

使用道具 举报

8#
发表于 2010-1-9 02:43:31 | 只看该作者
<%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
%>
回复 支持 反对

使用道具 举报

9#
发表于 2010-1-9 02:43:36 | 只看该作者
嘿嘿 可问题就是  你说的这个DIV 我不会啊
回复 支持 反对

使用道具 举报

10#
发表于 2010-1-9 02:43:40 | 只看该作者
<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>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-18 14:34 , Processed in 0.102834 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表