标题:在线等待解答-关于数据多行多列显示
只看楼主
xueanda
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-7
 问题点数:0 回复次数:4 
在线等待解答-关于数据多行多列显示

整个页面是这样的: 不同颜色为显示的内容
<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<html><head>
<title><%=webname%>--<%
leixing=lcase(trim(request("lx")))
leixing=replace(leixing,"'","")
select case leixing
case "big"
response.write "大類商品"
case "small"
response.write "小類商品"
case "tejia"
response.write "特價商品"
case "news"
response.write "新品上架"
case else
response.write "新品上架"
end select%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onMouseOver="window.status='〖<%=webname%>〗<%=weburl%>如果您喜歡本站,別忘暸告訴您的好友窩!';return false">

<table width="772" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFE0DD">
<tr>
<td width="1" background="image/images/bgbg.gif"></td>

<TR>
</table><td width="1" background="image/images/bgbg.gif"></td>
<td width="590" valign="top"> <div align="left">
<table width="591" align="center" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="100%" valign="top" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
<%leixing=lcase(trim(request("lx")))
if InStr(leixing,"'")>0 then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
response.end
end if
'leixing=replace(leixing,"'","")
select case leixing
case "big"
anclassid=trim(request("anid"))

if not isnumeric(anclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
response.end
else
if not isinteger(anclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
else

set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_anclass where anclassid="&anclassid,conn,1,1
anclassname=rs("anclass")

%>
<tr>
<td height=33 colspan="3" background="image/images/yemian/bgbg.gif"><img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >> <a href=class.asp?lx=big&anid=<%=anclassid%>><%=anclassname%></a> </td>
</tr>
<tr bgcolor="#FF71BD">
<td colspan="3" ><div align="center">
<table width="90%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF71BD">
<%
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_nclass where anclassid="&rs("anclassid")&" order by nclassidorder",conn,1,1
if rs_s.recordcount=0 then
%>
<tr>
<td width="100%" height="30" align="center" colspan="8">暂无小分类</td>
</tr>
<%
else
i=0
while not rs_s.eof
%>
<tr>
<td height="30"><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a>
<%rs_s.movenext
if rs_s.eof then
response.write " "
else
%> </td>
<td ><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a>
<%rs_s.movenext
if rs_s.eof then
response.write " "
else
%> </td>
<td ><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a>
<%rs_s.movenext
if rs_s.eof then
response.write " "
else
%> </td>
<td ><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a>
<%rs_s.movenext
if rs_s.eof then
response.write " "
else
%> </td>
<td ><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a>
<%rs_s.movenext
if rs_s.eof then
response.write " "
else
%> </td>
<td ><a href="class.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=rs_s("nclassid")%>"><u><%=rs_s("nclass")%></u></a> </td>
<%
rs_s.movenext
end if
end if
end if
end if
end if
wend
end if
end if
end if
%>
</tr>
</table><tr><TD width="1" background="image/images/bgbg.gif"></TD></tr>
</div></td>
</tr>
<%
case "small"
anclassid=request("anid")
if not isnumeric(anclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
response.end
else
if not isinteger(anclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
else
nclassid=request("nid")
if not isnumeric(nclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
response.end
else
if not isinteger(nclassid) then
response.write"<script>alert(""非法訪問!"");location.href=""../index.asp"";</script>"
else
set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_anclass where anclassid="&anclassid,conn,1,1
anclassname=rs("anclass")
rs.close
rs.open "select * from shop_nclass where nclassid="&nclassid,conn,1,1
nclassname=rs("nclass")
rs.close
%>
<tr>
<td height=33 colspan="3" background="image/images/yemian/bgbg.gif"> <img src="images/ring02.gif" width="23" height="15" align="absmiddle"> <a href=index.asp><%=webname%></a> >> <a href=class.asp?lx=big&anid=<%=anclassid%>><%=anclassname%></a> >> <%=nclassname%></td>
</tr>
<%
end if
end if
end if
end if

case "tejia"%>
<%case "hot"%>

<%case "news"%>
<%case else%>
<%end select%>
</table>
<%set rs=server.createobject("adodb.recordset")
if leixing="big" then
rs.open "select * from shop_books where anclassid="&anclassid&" order by adddate desc",conn,1,1
elseif leixing="small" then
rs.open "select * from shop_books where anclassid="&anclassid&" and nclassid="&nclassid&" order by adddate desc",conn,1,1
elseif leixing="hot" then
rs.open "select * from shop_books order by chengjiaocount desc",conn,1,1
elseif leixing="tejia" then
rs.open "select * from shop_books where tejiabook=1 order by adddate desc",conn,1,1
elseif leixing="news" then
rs.open "select * from shop_books where newsbook=1 order by adddate desc",conn,1,1
else
rs.open "select * from shop_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=5
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%" border="10" align="center" cellpadding="8" cellspacing="0" bordercolor="#FF71BD" bgcolor="#FFE0DD" class="table-xia">
<tr>
<td width="20%" rowspan="4" class="table-you" align="left"><table width="110" border="1">
<tr>
<td width="138"><table onMouseOver="this.style.backgroundColor='#FF6600'" onMouseOut="this.style.backgroundColor=''" width=90 height=91 cellspacing=1 cellpadding=2 bgcolor=#e1e1e1 border=0>
<tbody>
<tr>
<td align=center background="image/images/yemian/pic_bg2.gif" bgcolor=#ffffff><%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=80 border=0 height=80></a>
<%end if%> </td>
</tr>
</tbody>
</table>
<p>
<table width="91%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align=center> 價格:<%=rs("huiyuanjia")%> 元
<br> </td>
</tr>
</table></
p></td>
</tr>
</table>
</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 onsubmit=""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
%> </td>
</tr>
</table>
</div></td>
<td width="1" background="image/images/bgbg.gif"></td>
</tr>
</table>


</body>
</html>

现在是调用10行一列显示,可别人要求要4列,我试了一晚老是出错,只好求助大家帮忙,,,,,,,
谢谢了

[此贴子已经被作者于2005-11-7 2:44:54编辑过]

搜索更多相关主题的帖子: case response 数据 leixing 
2005-11-07 02:21
xueanda
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-7
得分:0 

现在的视图是这样的
2005-11-07 02:47
wjqhf88
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-9-6
得分:0 
&lt;br&gt;&lt;/br&gt;
2005-11-07 06:22
xueanda
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-7
得分:0 

If i Mod 4 = 0 Then
Response.Write "<br>"
End If
i = i + 1
Wend
这样写进去老出错

2005-11-07 09:53
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
得分:0 

<table width="100%" border="10" align="left" cellpadding

然后 if i mod 4 = 0 then response.write "<br>"

这样看看

2005-11-07 10:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-32880-1-1.html




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

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