| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 585 人关注过本帖
标题:下面是图片显示是否换到下一表格行输出和补齐单元格的代码,实才不懂,请行 ...
只看楼主 加入收藏
sylknb
Rank: 4
等 级:贵宾
威 望:14
帖 子:1547
专家分:184
注 册:2006-6-3
结帖率:79.38%
收藏
 问题点数:0 回复次数:5 
下面是图片显示是否换到下一表格行输出和补齐单元格的代码,实才不懂,请行家指教。
代码实才之长,我把与有关用红色标示

<!--#include file="conn.asp" -->
<!--#include file="yz_mgr/inc/function.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>飞雪网上购物系统</title>
<link href="inc/main.css" rel="stylesheet" type="text/css">
</head>
<% shopid=Request("shopid") %>
<body leftmargin="0" topmargin="0">
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><!--#include file="top.asp" --></td>
  </tr>
  <tr>
    <td height=40 class="text1">&nbsp;&nbsp;&nbsp;当前分类:
    <%
        Set Rs = Server.CreateObject("ADODB.RecordSet")
        Sql = "Select * From [Shop_Class] Where ID="&shopid
        Rs.Open Sql,Conn,1,1
        If Not Rs.Eof And Not Rs.Bof Then
            Response.Write Rs("Name")
        End If
        Rs.Close
        Set Rs=nothing
    %>   
    </td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">      
      <tr>
        <%    Dim i
            Set Rs = Server.CreateObject("ADODB.RecordSet")
            Sql = "Select * From [Shop_Goods] Where ShopID="&shopid
            Rs.Open Sql,Conn,1,1
            If Rs.Eof And Rs.Bof Then
                Response.Write "<tr><td height=60 colspan=5 align=center>没有对应商品!</td></tr>"
            Else
                Page = Request("Page")
                If Page="" Then Page=1
                Rs.PageSize = 15
                PageSize = Rs.PageSize
                Rs.AbsolutePage = Page
                i = 0
                Do While Not Rs.Eof    And PageSize>0               
        %>   
        <td width="20%" align="center" valign="top"><table width="160" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><a href="info.asp?shopid=<%=Rs("ShopID")%>&id=<%=Rs("ID")%>" target="_blank"><img src="uppic/<%=Rs("Pic")%>" width="160" height="150" class="imgborder" border="0"></a></td>
          </tr>
          <tr>
            <td align="center"><a href="info.asp?shopid=<%=Rs("ShopID")%>&id=<%=Rs("ID")%>" target="_blank"><%=Rs("Name")%></a></td>
          </tr>
          <tr>
            <td align="center">价格:¥<%=Rs("SalePrice")%></td>
          </tr>
          <tr>
            <td align="center"><a href="buy_car.asp?id=<%=Rs("ID")%>"><img src="images/btn_buy.gif" border=0></a>&nbsp;&nbsp;<a href="info.asp?shopid=<%=Rs("ShopID")%>&id=<%=Rs("ID")%>" target="_blank"><img src="images/btn_detail.gif" border=0></a></td>
          </tr>
        </table></td>
       <%            i = i + 1
                    If i mod 5 = 0 Then Response.Write "</tr><tr><td height=15 colspan=5></td></tr></tr>"
                    PageSize = PageSize-1
                    Rs.MoveNext
                Loop   
                If Rs.RecordCount mod 5 > 0 Then
                    For k = 1 to 5 - (Rs.RecordCount mod 5)
                        Response.Write "<td align=center  width='20%'>&nbsp;</td>"
                    Next
                End If        
        %>
      </tr>
      <tr>
        <td height="15" colspan="5"></td>
      </tr>
      <tr>
        <td colspan="5" align="right">
        <%
            Response.Write "每页" &Rs.PageSize& "条/共" &Rs.RecordCount& "条&nbsp;第" &Page& "页/共" &Rs.PageCount& "页&nbsp;"                 
            Response.Write "<a href=?shopid="&shopid&"&Page=1>首&nbsp;页</a>&nbsp;"
            If CInt(Page)>1 then
                Response.Write "<a href=?shopid="&shopid&"&Page="&Page-1&">上一页</a>&nbsp;"
            Else
                Response.Write "上一页&nbsp;"
            End If
            If CInt(Page)<Rs.PageCount then
                Response.Write "<a href=?shopid="&shopid&"&Page="&Page+1&">下一页</a>&nbsp;"        
            Else
                Response.Write "下一页&nbsp;"
            End If
            Response.Write "<a href=?shopid="&shopid&"&Page="&Rs.PageCount&">末&nbsp;页</a>&nbsp;"
        %>
        </td>
      </tr>
        <%    End If
            Rs.Close
            Set Rs=nothing
        %>   
    </table></td>
  </tr>
  <tr>
    <td><!--#include file="bottom.asp" --></td>
  </tr>
</table>
</body>
</html>
搜索更多相关主题的帖子: 输出 行家 表格 代码 齐单元 
2010-03-10 16:30
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
何谓不懂?
2010-03-10 16:47
sylknb
Rank: 4
等 级:贵宾
威 望:14
帖 子:1547
专家分:184
注 册:2006-6-3
收藏
得分:0 
<%         i = 0
  

  i = i + 1
                   If i mod 5 = 0 Then Response.Write "</tr><tr><td height=15 colspan=5></td></tr></tr>"
                    PageSize = PageSize-1
                    Rs.MoveNext
                Loop   
                If Rs.RecordCount mod 5 > 0 Then
                    For k = 1 to 5 - (Rs.RecordCount mod 5)
                        Response.Write "<td align=center  width='20%'>&nbsp;</td>"

                    Next
                End If        
        %>
1、标有红色的内容  2、"</tr><tr><td height=15 colspan=5></td></tr></tr>中、"</tr>这样写对否?与后面不配对
2010-03-10 17:58
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
表格的行列应该懂吧 直接html拼起来 懂html应该就懂
2010-03-10 18:09
sylknb
Rank: 4
等 级:贵宾
威 望:14
帖 子:1547
专家分:184
注 册:2006-6-3
收藏
得分:0 
我问的:If i mod 5 = 0 Then Response.Write "</tr><tr><td height=15 colspan=5></td></tr></tr>"
为什么被I被5除尽后换行,没有还在同一行?
单独</tr>这样标识与<tr></tr>有何区别?
2010-03-11 10:51
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
先去找html相关书籍看看吧
2010-03-11 11:37
快速回复:下面是图片显示是否换到下一表格行输出和补齐单元格的代码,实才不懂, ...
数据加载中...
 
   



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

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