| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 716 人关注过本帖
标题:[讨论]asp控制分2列
只看楼主 加入收藏
gqjian
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-9-7
收藏
 问题点数:0 回复次数:5 
[讨论]asp控制分2列

下面的代码只能1列显示 如果控制让他2列显示呀
(调用数据库图,库里有6大类,前面调用的是每一大类的一张图片,一共6张.也就是让他3行2列显示)

<table width="540" height="189" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<% dim sort_id
set rssort=server.CreateObject("adodb.recordset")
sqlsort="select * from sort order by sort_id asc"
rssort.open sqlsort,conn,1,2
do until rssort.eof
sort_id = rssort("sort_id")%>

<table width="172" border="0" align="center" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<%
set rs1=server.CreateObject("adodb.recordset")
sql="select top 1 * from hw where sort_id="& sort_id
rs1.open sql,conn,1,2
%>
<%
if not rs1.eof then
%>
<td width="546" valign="top" ><table height="207" align="left" cellpadding="0" cellspacing="0" class="as">
<tr>
<td width="169" height="192" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="299" height="18" valign="middle">
<a href="pro_dl.asp" target=_blank><img height="210" width="170" src="<%=rs1("hw_pic")%>" alt="点击查看商品:" border="0"></a></td>
</tr>
<tr>
<td width="299" height="43" valign="middle"><div align="center"><%=rssort("sort_name")%> 浏览次数:<%=rs1("click")%>
</div></td>
</tr>
</table></td>
</tr>
</table>
</td>

</tr>
<%end if%>
<%rs1.close
set rs1=nothing %>

</table>

<%
rssort.movenext
loop
rssort.close
set rssort=nothing
%></td>
</tr>
</table>

这段代码加在哪?会就加上在贴过来,我也加过但是不行,(就是刷新就加浏览次数的代码加到哪? )
<%
if not rs1.eof then
i=1
do while not rs1.eof%>


<%end if
rs1("click") = rs1("click")+1
rs1.update
rs1.movenext
i=i+1
loop
rs1.close
end if

%>

图片附件: 游客没有浏览图片的权限,请 登录注册

[此贴子已经被作者于2007-9-8 14:14:55编辑过]

搜索更多相关主题的帖子: sort 数据库 asp table 
2007-09-07 14:29
lecojason
Rank: 1
等 级:新手上路
帖 子:51
专家分:0
注 册:2007-9-5
收藏
得分:0 
回复:(gqjian)[讨论]asp控制分2列

<table width="172" border="0" align="center" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<%
set rs1=server.CreateObject("adodb.recordset")
sql="select top 1 * from hw where sort_id="& sort_id
rs1.open sql,conn,1,2
%>
<td width="546" valign="top" ><table height="207" align="left" cellpadding="0" cellspacing="0" class="as">
<tr>
<td width="169" height="192" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<%
if not rs1.eof then
i=1
do while not rs1.eof%>

<td width="299" height="18" valign="middle">
<a href="pro_dl.asp" target=_blank><img height="210" width="170" src="<%=rs1("hw_pic")%>" alt="点击查看商品:" border="0"></a></td>
<%
rs1("click") = rs1("click")+1
rs1.update
rs1.movenext
i=i+1
loop
rs1.close
end if %>

</tr>
<tr>
<td width="299" height="43" valign="middle"><div align="center"><%=rssort("sort_name")%> 浏览次数:<%=rs1("click")%>
</div></td>
</tr>
</table></td>
</tr>
</table>

应该是这样的.试试吧.

2007-09-07 15:40
gqjian
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-9-7
收藏
得分:0 
不行啊    不过还是谢谢

吹牛B可以 叫板一律拍S
2007-09-12 14:26
zsf2006
Rank: 1
来 自:博客园
等 级:新手上路
威 望:1
帖 子:315
专家分:0
注 册:2006-6-3
收藏
得分:0 
其实很简单啊
判断i 的值 若是i mod 2=0则
换行嘛

光临我的博客:http://
2007-09-12 15:09
gqjian
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2007-9-7
收藏
得分:0 
我知道 , 可加上就不行了 我试了

吹牛B可以 叫板一律拍S
2007-09-20 16:17
盖世豪侠
Rank: 1
等 级:新手上路
威 望:1
帖 子:444
专家分:0
注 册:2007-7-15
收藏
得分:0 

显示交给CSS就行了

定义CSS
<style type="text/css">
*{margin:0 auto;padding:0 auto}
.aa{width:425px;}
.aa div{width:200px;height:100px;float:left;margin:5px;}
</style>


response.write"<div class='aa'>"
while not rs.eof
response.write"<div>"&rs("xx")&"</div>"
rs.movenext
wend
response.write"</div>"


[此贴子已经被作者于2007-9-20 18:20:14编辑过]


[flash][/flash]
2007-09-20 17:37
快速回复:[讨论]asp控制分2列
数据加载中...
 
   



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

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