环太平洋31款机甲图片:网站开发问题:十万火急ASP分列显示问题 在线等

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 23:08:11
<%
sql = "select classID, classname from [Etype] where upID=0"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then arr_typeone=rs.GetRows()
rs.close
set rs= nothing
%>

<table width="90%" border="0" cellpadding="0" cellspacing="1" bgcolor="#B8C0D5" class="fontsize">
<%
for i=0 to ubound(arr_typeone,2)
arr_typetwo = ""
%>
<tr>
<td height="26" bgcolor="#E7E7E7"> <a href="listpro.asp?ont=<%=arr_typeone(0,i)%>"><b><%=trim(arr_typeone(1,i))%></b></a></td>
</tr>
<%
sql = "select classID, classname from [Etype] where upID="&arr_typeone(0,i)
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then arr_typetwo=rs.GetRows()
rs.close
set rs= nothing
if arr_typetwo(0,0)="" then
else
for m=0 to ubound(arr_typetwo,2)
%>
┠ <a href="listpro.asp?ont=<%=arr_typeone(0,i)%>&twt=<%=arr_typetwo(0,m)%>"><%=arr_typetwo(1,m)%></a>

<%

next
end if
next
%>
<tr>
<td height="8" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td height="26" bgcolor="#FFFFFF"> <a href="help.asp">客服中心</a> <a href="editregister.asp">会员面板</a> <a href="group.asp">集团购买</a> <a href="attract.asp">网上招商</a> <a href="cheap.asp">特价商品</a> <a href="aboutus.asp">关于我们</a></td>
</tr>
</table><%
conn.close
set conn=nothing
%>

===============================怎么我可以分2列显示??????

我不知道昨天是不是你。昨天我说的DIV的方法。
如果用table只需要判断 当i mod 列数=0的时候 输出<tr> 即可。
一行两个<tr> 在 输出<tr>的时候做个判断 if i mod 2 = 0 then response.write "<tr>"

用循环输出rs

比如一个分类的表 t_cate,结构和数据如下:

id | title | intro
-----------------------------------------
1 | 新闻 | 这里是新闻
2 | 教程 | 这里是教程
3 | 下载 | 这里是下载

好了,表建立好了,数据也有了,下面我们就要用到getrows咯!

dim rs_cate
dim arr_cate
set rs_cate=conn.execute("select id,title,intro from t_cate order by id asc")
arr_cate=rs_cate.getrows
set rs_cate=nothing

好了表数据已经导出到数组了!下面我们将遍历这个数组

dim arr_catenums,arr_catenumi
arr_catenums=ubound(arr_cate,2) '得到数组中数据的下标
for arr_catenumi=0 to arr_catenums
response.write("id:"&arr_cate(0,arr_catenumi)&" | 标题:"&arr_cate(1,arr_catenumi)&" | 介绍:"&arr_cate(2,arr_catenumi)&"<br>")
next

呵呵,好了,输出的数据为:
id:1 | 标题:新闻 | 介绍:这里是新闻
id:2 | 标题:教程 | 介绍:这里是教程
id:3 | 标题:下载 | 介绍:这里是下载

for i=0 to 2
循环<TD>..</TD>内容
exit for

<tr>
<%for i=1 to 总数%>
<td>
内容
</td>
<%if i mod 2 = 0 then response.write "</tr><tr>"%>
<%next%>
</tr>

太简单了。。 用表格的百分比宽度和。循环来实现啊。。在循环开始的时候定义一个变量,比如num=0 然后在循环中利用mod 来实现循环跳出。如你需要输出2列。
<tr>
for m=0 to ubound(arr_typetwo,2)
<td>
<a href="listpro.asp?ont=<%=arr_typeone(0,i)%>&twt=<%=arr_typetwo(0,m)%>"><%=arr_typetwo(1,m)%></a> </td>
if m mod 2 =0 then response.write "</tr><tr>" end if
next

</tr>

有什么不懂的可以继续问我。我的e-mail wuqiangf@yahoo.com.cn
希望我的回答对你的问题有所帮助