怎样让记录两条后转入下一行?

wenxiuyun10000 2004-08-11 04:54:49
如图:pv-w.com/asp.jpg

代码如下:
<!--#include file="../include/bkconn.asp"-->
<%
dim rs,sql
dim page,maxPerPage
maxPerPage=10 '每页显示的记录数
page=Request("page")
if (page="" or isempty(page)) then page=1
thisUrl="faqList.asp?true=1"
session("adminOldUrl")=thisUrl&"&page="&page
set rs=server.createobject("adodb.recordset")
sql="select * from faq where 1=1"
sql=sql&" order by id desc"
'response.write sql
'response.End
rs.open sql,conn,1,1
rs.pagesize=MaxPerPage
%>
<html>
<head>
<title>案例</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../main.css" type="text/css">
</head>

<body bgcolor="#9CC7EF" text="#000000" leftmargin="0" topmargin="0">
<div align="center"><br>
</div>
<table width="98%" border="1" bordercolordark=#9CC7EF bordercolorlight=#145AA0 cellspacing="0" cellpadding="4" align="center">
<tr bgcolor="#5EA5E6">
<td width="79%" nowrap>
<div align="center"><font color="#FFFFFF">部分使用考勤机客户案例</font></div>
</td>
</tr>
<%
dim rsID
i=1
if not (rs.eof or err) then rs.move (page-1)*maxPerPage
do while not (rs.eof or err)
rsID=rs("id")
%>
<tr>
<td width="79%"><%=rs("question")%></td>
</tr>
<%
i=i+1
if i>maxPerPage then exit do
rs.moveNext
loop
%>
<tr bgcolor="#4296E7">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>

<td width="12%">
 </td>

<td width="88%">
<div align="right"><font color=#FFFFFF><%=rs.recordCount%> 项 第<%=page%>/<%=rs.pageCount%>
页 </font>
<%if page>1 then%>
<input type="button" name="Submit3" value="首页" onClick="Javascript:jumpTo(1)">
<input type="submit" name="Submit4" value="上页" onClick="Javascript:jumpTo(2)">
<%else%>
<input type="button" name="Submit3" value="首页" disabled>
<input type="submit" name="Submit4" value="上页" disabled>
<%end if
if rs.recordCount>page*maxPerPage then%>
<input type="submit" name="Submit5" value="下页" onClick="Javascript:jumpTo(3)">
<input type="submit" name="Submit6" value="末页" onClick="Javascript:jumpTo(4)">
<%else%>
<input type="submit" name="Submit5" value="下页" disabled>
<input type="submit" name="Submit6" value="末页" disabled>
<%end if%>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
谢谢帮我解决
...全文
88 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenxiuyun10000 2004-08-11
  • 打赏
  • 举报
回复
能帮我写在代码里面吗?
wenxiuyun10000 2004-08-11
  • 打赏
  • 举报
回复
width="<%= 100/showline %>%"这个一定要吗?
QCB181 2004-08-11
  • 打赏
  • 举报
回复
说明一下,showline 就是用来控制每行显示的数目

可以这样定义
dim showline
showline=2
QCB181 2004-08-11
  • 打赏
  • 举报
回复
看我这个:

<table width="90%" border="0" cellspacing="1" cellpadding="1">
<%
dim showname
dim i
i=1
RowCount = rs.PageSize
Total=TotalPage*RowCount
do while not rs.eof and RowCount>0

%>
<% if i=1 or (i-1) mod showline=0 then%> <tr><% end if %>
<td>
<table width="<%= 100/showline %>%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td align="center"><a href="product_detail.asp?id=<%= rs("ID") %>"><img src="../upload_pic/<%= rs("picture_s") %>" alt="产品图片" width="<%= ImgWidth %>" height="<%= ImgHeight %>" border="0"></a></td>
</tr>
<%
select case which_show
case 0
%>
<tr>
<td align="center"><a href="product_detail.asp?id=<%= rs("ID") %>" title="<%= rs("name_cn") %>"><%= rs("name_cn") %></a></td>
</tr>
<tr>
<td align="center"><a href="product_detail.asp?id=<%= rs("ID") %>" title="<%= rs("product_sn") %>"><%= rs("product_sn") %></a></td>
</tr>
<% case 1 %>
<tr>
<td align="center"><a href="product_detail.asp?id=<%= rs("ID") %>" title="<%= rs("name_cn") %>"><%= rs("name_cn") %></a></td>
</tr>
<% case 2 %>
<tr>
<td align="center"><a href="product_detail.asp?id=<%= rs("ID") %>" title="<%= rs("product_sn") %>"><%= rs("product_sn") %></a></td>
</tr>
<% end select %>
</table>

</td>
<% if i mod showline=0 then%></tr><% end if %>
<%
RowCount=RowCount-1
i=i+1
rs.movenext
loop
%>
</table>
wenxiuyun10000 2004-08-11
  • 打赏
  • 举报
回复
能帮我写在代码里面吗?
ycted 2004-08-11
  • 打赏
  • 举报
回复
先定义k=0在for语句里做个判断
k=k+1
if k mod 2 =0 then response.write("</tr><tr>")
chenxuchen 2004-08-11
  • 打赏
  • 举报
回复
用变量i来控制,在输出记录时i加1,当i mod 2 =0时.输出一个<br>
chenxuchen 2004-08-11
  • 打赏
  • 举报
回复
用变量i来控制,在输入记录时i加1,当i mod =0时.输出一个<br>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧