| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 830 人关注过本帖
标题:郁闷呀~~谁来看看这代码
只看楼主 加入收藏
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
 问题点数:0 回复次数:5 
郁闷呀~~谁来看看这代码
<table width="1001" cellpadding="0" cellspacing="0" align="center" border="1">
<tr><td>
<%
      set rs=server.CreateObject("adodb.recordset")
                      rs.open "select top 10 * from [ly] where id="&request("id")&" order by lyid DESC",conn,1,3
      if rs.eof and rs.bof then
      %>
     <table width="100%"  border="0" cellspacing="5" cellpadding="0">
  <tr>
    <td>暂无评论</td>
  </tr>
</table>
<%else%>
<table width="100%"  border="0" align="right" cellpadding="5" cellspacing="0">
      <% do while not rs.eof %>
                    <tr>
     <td><img src="images/doc.gif" width="11" height="11" /> <font color="#FF0000"><%=rs("name1")%>:</font><%=rs("connect")%> [<%=rs("date")%>]</td>
       </tr>
       <tr>
     <td height="1" bgcolor="#B7B7B7"></td>
       </tr>
       <% rs.movenext
                  loop %>
                <% rs.close
                  set rs=nothing %>
                <% end if %>
    <tr><td height="1" bgcolor="#B7B7B7"></td></tr>
                  </table>
      </td>
      </tr>
</table>

加上这段代码后 当有数据的时候排版正常 但是没得数据显示"暂无评论"的时候 就会把整个页面撑破
求解

[[italic] 本帖最后由 sydpoechang 于 2007-12-2 19:28 编辑 [/italic]]
搜索更多相关主题的帖子: 代码 
2007-12-02 19:27
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
width="100%"关键在于这个标的width被设置为100%
2007-12-02 19:52
heavenlc
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-12-2
收藏
得分:0 
把 <table width="100%"  border="0" cellspacing="5" cellpadding="0">删除掉,
当条件满足时只显示<tr>部分就可以了
2007-12-02 23:32
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #B7B7B7">
                <tr>
                  <td bgcolor="D9D9D9" height="20">?<strong><font color="#FF0000">10</font>条最新留言:</strong></td>
  </tr>
                <tr>
                  <td>
                  <%
                  set rs=server.CreateObject("adodb.recordset")
                      rs.open "select top 10 * from [ly] where id="&request("id")&" order by lyid DESC",conn,1,3
                     if rs.eof and rs.bof then
                  %>
  <tr>
    <td>暂无评论</td>
  </tr>
<%else%>
 <table width="100%"  border="0" align="right" cellpadding="5" cellspacing="0">
                  <% do while not rs.eof %>
                    <tr>
                    <td><img src="images/doc.gif" width="11" height="11" />?<font color="#FF0000"><%=rs("name1")%>:</font><%=rs("connect")%>?[<%=rs("date")%>]</td>
                      </tr>
                      <tr>
                    <td height="1" bgcolor="#B7B7B7"></td>
                      </tr>
                      <% rs.movenext
                  loop %>
                <% rs.close
                  set rs=nothing %>
                <% end if %>
                <tr><td height="1" bgcolor="#B7B7B7"></td></tr>
                  </table>
                  </td>
  </tr>
                <tr>
                    <td bgcolor="D9D9D9" height="20">?<strong>谈谈你的想法:</strong></td>
  </tr>
                  <tr>
                    <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="5"></td>
                      </tr><form id="form1" name="form1" method="post" action="lysave.asp">
                      <tr>
                        <td>昵称:<input type="text" name="name1">
                            ?认证码:<input name="s" type="text" size="10">?<b><%=s%></b>
              <input maxlength=20 name="s2" size=12 type=hidden value="<%=s%>"></td>
                      </tr>
                      <tr>
                        <td height="5"></td>
                      </tr>
                      <tr>
                        <td><textarea name="connect" cols="100" rows="5"></textarea></td>
                      </tr>
                      <tr>
                        <td height="5"></td>
                      </tr>
                      <tr>
                        <td><div align="right">
                          <input type="submit" name="tj" value="提交">
                          <input type="hidden" name="id" value="<%=Request.Querystring("id")%>">
                        </div></td>
                      </tr></form>
    <tr>
                        <td height="5"></td>
                      </tr>
                    </table></td>
                  </tr>
</table>

是这样吗?感觉没什么用
2007-12-04 11:15
xiang588
Rank: 1
等 级:新手上路
帖 子:32
专家分:0
注 册:2007-11-29
收藏
得分:0 
<% end if %>
    <tr><td height="1" bgcolor="#B7B7B7"></td></tr>
                  </table>


改成


               
    <tr><td height="1" bgcolor="#B7B7B7"></td></tr>
                  </table><% end if %>

Coder&Teacher&Dreamer
2007-12-04 11:22
craft001wen
Rank: 2
等 级:论坛游民
帖 子:242
专家分:62
注 册:2006-5-4
收藏
得分:0 
整个代码改为:
<table width="1001" cellpadding="0" cellspacing="0" align="center" border="1">
<tr><td>
<table width="100%"  border="0" align="right" cellpadding="5" cellspacing="0">
<%
      set rs=server.CreateObject("adodb.recordset")
                      rs.open "select top 10 * from [ly] where id="&request("id")&" order by lyid DESC",conn,1,3
      if rs.eof and rs.bof then
      %>
   
  <tr>
    <td>暂无评论</td>
  </tr>

<%else%>

      <% do while not rs.eof %>
                    <tr>
     <td><img src="images/doc.gif" width="11" height="11" /> <font color="#FF0000"><%=rs("name1")%>:</font><%=rs("connect")%> [<%=rs("date")%>]</td>
       </tr>
       <tr>
     <td height="1" bgcolor="#B7B7B7"></td>
       </tr>
       <% rs.movenext
                  loop %>
                <% rs.close
                  set rs=nothing %>
                <% end if %>
    <tr><td height="1" bgcolor="#B7B7B7"></td></tr>
                  </table>
      </td>
      </tr>
</table>

2007-12-04 12:32
快速回复:郁闷呀~~谁来看看这代码
数据加载中...
 
   



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

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