{求救}如何再实现两行四列,请教高手解决,急用!!!!!

gxl598 2003-09-11 01:49:45
目前已经实现显示记录一行四列.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/bbsbak.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "dsn=SQL Server;uid=sa;pwd=123456789;"
Recordset1.Source = "SELECT * FROM dbo.bxdlr"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 4
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保险代理人</title>
<link href="CSS/REG.css" rel="stylesheet" type="text/css">
</head>

<body background="images/bg.gif" link="#000000" vlink="#000000" alink="#000000" marginheight="0">
<table width="97%" height="179" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<% do while ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<td height="129"> <div align="center"> <a href="<%=(Recordset1.Fields.Item("mb").Value)%>?userid=<%=(Recordset1.Fields.Item("userid").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("userphoto").Value)%>" alt="userphoto" width="82" height="104" border="1"></a><br>
<%=(Recordset1.Fields.Item("nicheng").Value)%><br>
<br>
人气指数  <%=(Recordset1.Fields.Item("click").Value)%><br>
<p></p>
</div></td>
<%
i=i+1
if i mod 4 = 0 then
exit do

response.write "<td> </td>"
end if
Recordset1.movenext
loop
%>
</tr>
</table>
<p>  </p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
...全文
30 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
summersun418 2003-09-11
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/bbsbak.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "dsn=SQL Server;uid=sa;pwd=123456789;"
Recordset1.Source = "SELECT * FROM dbo.bxdlr"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 4
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保险代理人</title>
<link href="CSS/REG.css" rel="stylesheet" type="text/css">
</head>

<body background="images/bg.gif" link="#000000" vlink="#000000" alink="#000000" marginheight="0">
<table width="97%" height="179" border="0" align="center" cellpadding="0" cellspacing="0">
<%for i=1 to 2%>
<tr>
<%for j=1 to 4%>
<%if not Recordset1.EOF then%>
<td height="129"> <div align="center"> <a href="<%=(Recordset1.Fields.Item("mb").Value)%>?userid=<%=(Recordset1.Fields.Item("userid").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("userphoto").Value)%>" alt="userphoto" width="82" height="104" border="1"></a><br>
<%=(Recordset1.Fields.Item("nicheng").Value)%><br>
<br>
人气指数  <%=(Recordset1.Fields.Item("click").Value)%><br>
<p></p>
</div></td>
<%
Recordset1.movenext
else
%>
<td height="129"> </td>
<%end if%>
<%next%>
</tr>
<%next%>
</table>
<p>  </p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


关键:
<%for i=1 to 2%>
<tr>
<%for j=1 to 4%>
<%if not Recordset1.EOF then%>
<td height="129"> <div align="center"> <a href="<%=(Recordset1.Fields.Item("mb").Value)%>?userid=<%=(Recordset1.Fields.Item("userid").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("userphoto").Value)%>" alt="userphoto" width="82" height="104" border="1"></a><br>
<%=(Recordset1.Fields.Item("nicheng").Value)%><br>
<br>
人气指数  <%=(Recordset1.Fields.Item("click").Value)%><br>
<p></p>
</div></td>
<%
Recordset1.movenext
else
%>
<td height="129"> </td>
<%end if%>
<%next%>
</tr>
<%next%>
popcode 2003-09-11
  • 打赏
  • 举报
回复
<table width="97%" height="179" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<% do while ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<td height="129"> <div align="center"> <a href="<%=(Recordset1.Fields.Item("mb").Value)%>?userid=<%=(Recordset1.Fields.Item("userid").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("userphoto").Value)%>" alt="userphoto" width="82" height="104" border="1"></a><br>
<%=(Recordset1.Fields.Item("nicheng").Value)%><br>
<br>
人气指数  <%=(Recordset1.Fields.Item("click").Value)%><br>
<p></p>
</div></td>
<%
i=i+1
if i mod 4 = 0 then
exit do

response.write "<td> </td> </tr><tr>"
end if
Recordset1.movenext
loop
%>
</tr>
</table>
xiaobird1 2003-09-11
  • 打赏
  • 举报
回复
不知道对你有没有帮助:
http://expert.csdn.net/Expert/topic/2197/2197705.xml?temp=.8195307

28,390

社区成员

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

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