ASP高手来解决 1行2列循环?
<!--#include file="conn.asp"-->
<%
strsql="select top 50 * from 招聘信息 order by 发布日期 desc"
set rs = server.CreateObject("adodb.recordset")
set rs1 = server.CreateObject("adodb.recordset")
rs.open strsql,conn,1,1
for i = 1 to rs.recordcount
if rs.eof then exit for
strsql="select 公司名称,会员 from 公司资料 where 帐号='"&rs("公司名称")&"'"
rs1.open strsql,conn,1,1
if rs.eof then exit for
if i mod 4 = 0 then response.Write("</tr><tr bgcolor='#FFF'>")
%>
<TABLE width=100%
border=0 align="center" cellPadding=6 cellSpacing=1 bgcolor="#F3F" class=pt >
<TBODY>
<TR bgcolor="#FFF">
<TD width=211 height=25 >
<div align="left"><FONT color=green><IMG height=6 src="images/02420582.gif" width=9> <span class="style9"><a href="gszp.asp?cname=<%=rs("公司名称")%>" target="_blank"><font color="#666"><%=rs1(0)%></font></a></span><span class="a02">
<%if rs1(1) then%>
</span> <img src="images/200752713740910.gif" alt="企业收费会员" width="11" height="11" border="0">
<%end if%>
</FONT></div></TD>
<TD width=284 height=25><div align="left"><span class="style9">聘:</span><font color=green> <a href="zpgw.asp?cname=<%=rs("公司名称")%>&jnname=<%=rs("职能职位")%>&jtname=<%=rs("具体职务")%>" target="_blank" class="white"><font color="#666"><%=rs("职能职位")%>,<%=rs("具体职务")%></font></a></font></div></TD>
</TR>
</TBODY>
</TABLE>
<%
rs1.close()
rs.movenext
next
rs.close()
set rs1 = nothing
%>
现在显示的是一行循环 怎么可以变成1行2列循环??
1----
2----
3----
4----
变成这样子的 !
1--- 2---
3--- 4---
补充:不要说理论 改我提出的代码 我自己分析 谢谢
答案:我对你的代码进行了修改,在我的机上运行是可以的
没有完全明白你的意思,也不知道是否符合你要求
我是这样显示的:
新建一个一行两列表格
然后在左右列分别显示
<!--#include file="conn.asp"-->
<%
strsql="select top 50 * from 招聘信息 order by 发布日期 desc"
set rs = server.CreateObject("adodb.recordset")
set rs1 = server.CreateObject("adodb.recordset")
rs.open strsql,conn,1,1
for i = 1 to rs.recordcount
if rs.eof then exit for
strsql="select 公司名称,会员 from 公司资料 where 帐号='"&rs("公司名称")&"'"
rs1.open strsql,conn,1,1
if rs.eof then exit for
if i mod 4 = 0 then response.Write("</tr><tr bgcolor='#FFF'>")
%>
<table width="750" border="1">
<tr>
<td width="363">
<TABLE width=100%
border=0 align="center" cellPadding=6 cellSpacing=1 bgcolor="#F3F" class=pt >
<TBODY>
<TR bgcolor="#FFF">
<TD width=410 height=25 >
<div align="left">
<FONT color=green><IMG height=6 src="images/02420582.gif" width=9>
<span class="style9">
<a href=> <font color="#666"><%=rs1(0)%>
</font>
</a>
</span>
<span class="a02"> <%if rs1(1) then%>
</span> <img src="images/200752713740910.gif" alt="企业收费会员" width="11" height="11" border="0">
<%end if%>
</FONT>
</div>
</TD>
<TD width=552 height=25>
<div align="left"><span class="style9">聘:</span>
<font color=green>
<a href=> </TD>
</TR>
</TBODY>
</TABLE>
<%'end if%>
</td>
<td width="322">
<%
i=i+1
rs.movenext
if rs.eof then exit for
%>
<TABLE width=100%
border=0 align="center" cellPadding=6 cellSpacing=1 bgcolor="#F3F" class=pt >
<TBODY>
<TR bgcolor="#FFF">
<TD width=410 height=25 >
<div align="left">
<FONT color=green><IMG height=6 src="images/02420582.gif" width=9>
<span class="style9">
<a href=> <font color="#666"><%=rs1(0)%>
</font>
</a>
</span>
<span class="a02"> <%if rs1(1) then%>
</span> <img src="images/200752713740910.gif" alt="企业收费会员" width="11" height="11" border="0">
<%end if%>
</FONT>
</div>
</TD>
<TD width=552 height=25>
<div align="left"><span class="style9">聘:</span>
<font color=green>
<a href=> </TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
</table>
<%
rs1.close()
rs.movenext
next
rs.close()
set rs1 = nothing
%>
<!--#include file="conn.asp"-->
<%
strsql="select top 50 * from 招聘信息 order by 发布日期 desc"
set rs = server.CreateObject("adodb.recordset")
set rs1 = server.CreateObject("adodb.recordset")
rs.open strsql,conn,1,1
for i = 1 to rs.recordcount
if rs.eof then exit for
strsql="select 公司名称,会员 from 公司资料 where 帐号='"&rs("公司名称")&"'"
rs1.open strsql,conn,1,1
if rs.eof then exit for
if i mod 4 = 0 then response.Write("</tr><tr bgcolor='#FFF'>")
%>
<table width="750" border="1">
<tr>
<td width="363">
<TABLE width=100%
border=0 align="center" cellPadding=6 cellSpacing=1 bgcolor="#F3F" class=pt >
<TBODY>
<TR bgcolor="#FFF">
<TD width=410 height=25 >
<div align="left">
<FONT color=green><IMG height=6 src="images/02420582.gif" width=9>
<span class="style9">
<a href=> <font color="#666"><%=rs1(0)%>
</font>
</a>
</span>
<span class="a02"> <%if rs1(1) then%>
</span> <img src="images/200752713740910.gif" alt="企业收费会员" width="11" height="11" border="0">
<%end if%>
</FONT>
</div>
</TD>
<TD width=552 height=25>
<div align="left"><span class="style9">聘:</span>
<font color=green>
<a href=> </TD>
</TR>
</TBODY>
</TABLE>
<%'end if%>
</td>
<td width="322">
<%
i=i+1
rs.movenext
if rs.eof then exit for
%>
<TABLE width=100%
border=0 align="center" cellPadding=6 cellSpacing=1 bgcolor="#F3F" class=pt >
<TBODY>
<TR bgcolor="#FFF">
<TD width=410 height=25 >
<div align="left">
<FONT color=green><IMG height=6 src="images/02420582.gif" width=9>
<span class="style9">
<a href=> <font color="#666"><%=rs1(0)%>
</font>
</a>
</span>
<span class="a02"> <%if rs1(1) then%>
</span> <img src="images/200752713740910.gif" alt="企业收费会员" width="11" height="11" border="0">
<%end if%>
</FONT>
</div>
</TD>
<TD width=552 height=25>
<div align="left"><span class="style9">聘:</span>
<font color=green>
<a href=> </TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
</table>
<%
rs1.close()
rs.movenext
next
rs.close()
set rs1 = nothing
%>
上一个:asp如何判断选择时间比当前系统时间小
下一个:使用asp.net导出word的小问题