function CheckForm() 

document.form1.txtcontent.value=document.getElementsByTagName("span")[0].innerHTML
//alert(document.form1.txtcontent.value);
return true;
} <form method="post" action="dd/index2.asp" onsubmit="return CheckForm()" name="form1"> <textarea name="txtcontent" id="txtcontent" style="display:none"> </textarea>
<input type=hidden name=test value=insert><span>
<table  id="tab1"  border="1"  align="center"  cellpadding="1"  cellspacing="0" 
bordercolor="#708090" width="98%">
<tr >
<td ><b>客户</b></td>
<td ><b>品名</td>
<td ><b>类型</td>
<td ><b>规格</td>
<td ><b>数量</td>
<td ><b>配件</td>
<td ><b>备注</td>
<td><b>交货日期</td>
</tr>
</table>
</span>==========把整个<span></span>间的html代码插入数据库的content字段,然后显示出来。问题来了,表格靠底部显示,上面有大片空白。我把截图上传给大家看看。下面是留言本相关代码。求助ing                      <td bgcolor="#cccccc" height=60 >                                        
                        <table border=0 cellpadding=0 cellspacing=2 width="100%">
                          <tr >
                            <td ><%=content%></td>
                          </tr>
                         </table>
                      </td>
                 

解决方案 »

  1.   

                               <tr >
                                <td bgcolor=pink onclick=s(this)><%=content%></td>
                              </tr>
    content里面就是提交的内容啊,我用函数function s(obj){
    var t=obj.innerText;
    alert(t);}把内容显示出来的时候发现是竖着排列的,即:
    客户
    品名
    类型
    规格
    数量
    配件
    备注
    交货日期
      

  2.   

    <td   bgcolor="#cccccc"   height=60>                                                                                 
    <table   border=0   cellpadding=0   cellspacing=2   width="100%"> 
    <tr   > 
    <td   > <%=content%> </td> 
    </tr> 
    </table> 
    </td>
    肯定是布局问题,这只是table一部分,lz最好是把最外层的table结构贴出来
      

  3.   


    <td   bgcolor="#cccccc"   height=60   >                                                                                 
                                                    <table   border=0   cellpadding=0   cellspacing=2   width="100%"> 
                                                        <tr   > 
                                                            <td   >
    <!---->
    <table     id="tab1"     border="1"     align="center"     cellpadding="1"     cellspacing="0"   
    bordercolor="#708090"   width="98%"> 
    <tr   > 
    <td   > <b> 客户 </b> </td> 
    <td   > <b> 品名 </td> 
    <td   > <b> 类型 </td> 
    <td   > <b> 规格 </td> 
    <td   > <b> 数量 </td> 
    <td   > <b> 配件 </td> 
    <td   > <b> 备注 </td> 
    <td> <b> 交货日期 </td> 
    </tr> 
    </table> 
    <!---->
     
     </td> 
                                                        </tr> 
                                                      </table> 
                                                </td> 
    看你CSS或其他地方的影响了。
      

  4.   

    再外面的table呢?lz试试tab1.outerHTML是什么东东
      

  5.   

                        <tr> 
                           <td bgcolor="<%=rs9("bgss")%>" height=20>
                            <table border=0 cellpadding=0 cellspacing=0 width="99%">
                              <tbody>
                              <tr>
                                <td valign=bottom width="50%"><font class=cha2> 发表于:<% =dateandtime%></font>
                               </td>
                              </tr>
                              </tbody>
                            </table>
                        </tr>
                        <tr>
                          <td bgcolor="#cccccc" height=60 >                                        
                            <table border=0 cellpadding=0 cellspacing=2 width="100%">
                              
                              <tr >
                                <td bgcolor=pink onclick=s(this)><%=content%></td>
                              </tr>
                              
                            </table>
                          </td>
                        </tr>
    ---------------------------------------------------
    我是个css盲啊  我觉得就在输出这个单元格里啊,其他地方也会对<td>里面的布局有影响吗?
      

  6.   

    function   s(obj){ 
    var   t=obj.innerText; 
    alert(t);}
    ============>
    function   s(obj){ 
    var   t=obj.innerHTML; 
    alert(t);}
    试试看,输出来的是什么东东
      

  7.   

    alert(document.form1.txtcontent.value); alert(document.getElementById("tab1").outerHTML)都是没问题的我数了下table有18个(九对),我是改现成的留言板代码,显示文本是正常的,就表格有问题,郁闷不已
      

  8.   

    回lihui_shine    t=obj.innerHTML; alert(t);显示也正常在留言板的文本框输入    <table border='1' cellpadding='1' cellspacing='0' bordercolor='#708090'><tr><td><b>客户</b></td><td><b>品名</td><td><b>类型</td><td><b>规格</td><td><b>数量</td><td><b>配件</td><td><b>备注</td><td><b>交货日期</td></tr></table>
     显示的时候是居中的,
    function    s(obj){   
    var  t=obj.innerText;   
    alert(t);}显示出来是水平的,即:  客户品名类型规格数量配件备注交货日期
    而不再像先前竖着排列了: 
    客户 
    品名 
    类型 
    规格 
    数量 
    配件 
    备注 
    交货日期 
      

  9.   

    我把style贴出来吧,下班了,办公室空调都不开,冷死人,大侠们帮忙啊 小弟先闪了,明早8点来
    <style>
    <!--
    BODY{ SCROLLBAR-FACE-COLOR: #cccccc; FONT-SIZE: 10px; SCROLLBAR-HIGHLIGHT-COLOR: #cccccc; SCROLLBAR-SHADOW-COLOR: #cccccc; COLOR: #333333; SCROLLBAR-3DLIGHT-COLOR: #ffffff; LINE-HEIGHT: normal; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-TRACK-COLOR: #efefef; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; SCROLLBAR-DARKSHADOW-COLOR: #999999 }
    table, td{ font:9pt "宋体" }
    A { COLOR: #000000; TEXT-DECORATION: none }
    A:hover { COLOR: #000000; TEXT-DECORATION:none }
    .td{ font-family:"宋体";font-size:9pt;line-height:150% }
    .big{ font:14.8px "宋体" }
    input{ height:18px;border-left:1px ridge #ffffff;border-top:1px ridge #ffffff;border-bottom:1px ridge;border-right:1px ridge;background-color:#efefef;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt; font-family:宋体 }
    select{background-color: #FFFFFF;border: 1px dotted #999999;font-size: 9pt;color: black;}
    -->
    </style>
      

  10.   

    以下是留言板代码,长度超出了系统限制我去除了textarea框以及一些其他代码(index.asp)===============<%@ Language=VBScript %>
    <!--#INCLUDE FILE="conn.asp" -->
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql = "Select * FROM guestbook Order By dateandtime desc"    '====帖子按时间顺序先后排列
    rs.open sql,conn,1,1
    %><HTML>        
    <HEAD>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="Keywords" CONTENT="<%=rs9("name")%>,留言簿">
    <meta name="description" content="<%=rs9("name")%>的留言簿">
    <style>
    <!--
    BODY{ SCROLLBAR-FACE-COLOR: #cccccc; FONT-SIZE: 10px; SCROLLBAR-HIGHLIGHT-COLOR: #cccccc; SCROLLBAR-SHADOW-COLOR: #cccccc; COLOR: #333333; SCROLLBAR-3DLIGHT-COLOR: #ffffff; LINE-HEIGHT: normal; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-TRACK-COLOR: #efefef; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; SCROLLBAR-DARKSHADOW-COLOR: #999999 }
    table, td{ font:9pt "宋体" }
    A { COLOR: #000000; TEXT-DECORATION: none }
    A:hover { COLOR: #000000; TEXT-DECORATION:none }
    .td{ font-family:"宋体";font-size:9pt;line-height:150% }
    .big{ font:14.8px "宋体" }
    input{ height:18px;border-left:1px ridge #ffffff;border-top:1px ridge #ffffff;border-bottom:1px ridge;border-right:1px ridge;background-color:#efefef;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt; font-family:宋体 }
    select{background-color: #FFFFFF;border: 1px dotted #999999;font-size: 9pt;color: black;}
    -->
    </style>
    <script language=javascript>
    <!--
    function s(obj){
    //var t=document.getElementsByTagName("span")[0].innerHTML;
    var t=obj.innerText
    alert(t);}
    -->
    </script>
    </head><body leftMargin="0" topMargin="0" bgcolor="<%response.write session("color")%>">
    <BR><BR><BR><BR>
    <table width="740" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td background="images/bg_left.gif" valign="top" width="100%">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3"><img src="images/left_kuang_top.gif" width="100%" height="4"></td>
            </tr>
            <tr>
              <td width="4" background="images/left_kuang_left.gif"><img src="images/left_kuang_left.gif" width="4" height="2"></td>
              <td width="100%" valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="5" height="100%">
                  <tr>
                    <td class="td" valign="top">
                      <table align=center border=0 cellpadding=0 cellspacing=1 bgcolor="<%=rs9("bian")%>" width=100%>
                        <tbody>    
                       
    <%
    dim i
    i=1
    do while not rs.eof  and mypagesize>0
    id=rs("gbookid")
    name=rs("name")
    email=rs("email")
    homepage=rs("homepage")
    oicq=rs("oicq")
    come=rs("come")
    head=rs("head")
    content=rs("content")             '===================提取内容
    content=Autolink(content)
    dateandtime=rs("dateandtime")
    reply=rs("reply")
    reply=addlink(reply)
    sex=rs("sex")
    %>
                                              <!--  ==========留言显示区========    -->
                        <tr> 
                           <td bgcolor="<%=rs9("bgss")%>" height=20>
                            <table border=0 cellpadding=0 cellspacing=0 width="99%">
                              <tbody>
                              <tr>
                                <td valign=bottom width="50%"><font class=cha2> 发表于:<%=dateandtime%></font>
                               </td>
                              </tr>
                              </tbody>
                            </table>
                        </tr>
                        <tr>
                          <td bgcolor="#cccccc" height=60 >                                        
                            <table border=0 cellpadding=0 cellspacing=2 width="100%">
                              
                              <tr >
                                <td bgcolor=pink onclick=s(this)><%=content%></td>
                              </tr>
                              
                            </table>
                          </td>
                        </tr>
                        
    <%
    mypagesize=mypagesize-1
    i=i+1
    rs.movenext
    loop
    %>
                        <tr>
                          <td bgcolor="<%=rs9("bgs")%>" colspan=2 height=18 valign=bottom>
                            <div align=center>
                              <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
                                <form name="form2" method="post" action="index.asp">
                                  <tr>
                                    <td align="right" height="22"><font color="#000000">共<b><%=rs.pagecount%></b>页<b><%=total%></b>条留言
                                      当前第<b><%=page%></b>页 <a href="?page=1" class="black">首页</a>
                                      <%if page>1 then%>
                                      <a href=?page=<%=page-1%> class="black">上一页</a>
                                      <%else%>
                                      上一页
                                      <%end if%>
                                      <%if page<rs.pagecount   then%>
                                      <a href=?page=<%=page+1%> class="black">下一页</a>
                                      <%else%>
                                      下一页
                                      <%end if%>
                                      <a href=?page=<%=rs.pagecount%> class="black">尾页</a>
     
                                      <select name="page" class="bottom">
                                        <%for i=1 to rs.pagecount%>
                                        <option value=<%=i%>
     <%
      if i=page then
      response.write" selected"
      end if
      %>
    ><%=i%></option>
                                        <%next%>
                                      </select>
                                      <input type="submit" name="Submit22" value="转向" class="bottom">
                                      </font>

    </td>
                                  </tr>
                                </form>
                              </table>               
                            </div>
                          </td>
                        </tr>
                        </tbody>
                      </table>                                                            </td>
                  </tr>
                </table>
              </td>
              <td width="4" background="images/left_kuang_left.gif"><img src="images/left_kuang_left.gif" width="4" height="2"></td>
            </tr>
            <tr>
              <td colspan="3"><img src="images/left_kuang_bottom.gif" width="100%" height="4"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
            <tr>
              <td height="8"></td>
            </tr>
          </table>
          </td>
        <td width="8" bgcolor="#FFFFFF"></td>
      </tr>
    </table></body>
    </html>
      

  11.   

    表单提交给index2.asp<%@ Language=VBScript %>
    <!--#INCLUDE FILE="conn.asp" -->
    <%
    txtcontent=trim(request("txtcontent"))Set rs= Server.CreateObject("ADODB.Recordset")
    sql="select * from guestbook"
    rs.open sql,conn,3,2
    rs.addnew                                    '============添加 rs("name")=txtname
    rs("email")=txtemail
             rs("homepage")=txthomepage
                    rs("come")=txtcome
    rs("oicq")=txtoicq
    rs("content")=txtcontent    
    rs("head")=pic
    rs("dateandtime")=now()
    rs("reply")=reply
    rs("ip")=Request.ServerVariables("REMOTE_HOST")
    rs("sex")=cint(sex)
    rs.update                  
                      rs.close
    if cint(posttime)<>0 then
    session("posttime")=now()
    end if
    'response.redirect "index.asp"
    response.write "txtcontent"&txtcontent
    conn.close
    set conn=nothing
    %>
      

  12.   

    自己了结算鸟:
    不用改别人的代码,自己做,table嵌套table,这样一来排列总算整齐了,由于不懂css所以粗糙点。还有一个问题就是大量无用的html代码。我的本意是把订单提交之后可以连续显示,就像留言板显示留言一样;一个订单的项数是不确定的,所以做成了可以动态增减行的表格,单元格里嵌套文本框,这样无用的代码更多了。现在我只能想到把html代码连同真正有用的数据一起提交显示,呵呵 这是典型的菜鸟法,不知道大虾们还有没更好的办法。三个test文件如下:
    order.asp<SCRIPT> 
    function add(obj)
    {  tr=tab1.insertRow() for(i=0;i<obj.cells.length;i++)
     {
     tr.style.backgroundColor=""
     tr.onmouseout=function(){this.bgColor=""}
     tr.onmouseover=function(){this.bgColor="#ff69b4"} 
     tr.ondblclick=function(){add(this)}
     tr.insertCell(i).innerHTML=obj.cells(i).innerHTML
     }
       
    }function delRow()

    event.cancelBubble=true; 
    with (event.srcElement.parentElement) 
      { 
    if (tagName.toLowerCase()=="tr"&&rowIndex>1) tab1.deleteRow(rowIndex); 
      } 
    } function CheckForm() 

    document.form1.txtcontent.value=document.getElementsByTagName("span")[0].innerHTML;
    alert(document.form1.txtcontent.value);
    return true;} </SCRIPT> 
    <html>
    <head><title>制单</title>
    </head>
    <body >
    <br><br>
                                
    <form method="post" action="dd/index2.asp" onsubmit="return CheckForm()" name="form1"> <textarea name="txtcontent" id="txtcontent" style="display:none"> </textarea><span>
    <table  id="tab1"   align="center" border="1" cellpadding="1"  cellspacing="0" 
    bordercolor="#cccccc" onclick="delRow();"  width="90%">
    <tr >
    <td ><b>客户</td>
    <td ><b>品名</td>
    <td ><b>类型</td>
    <td ><b>规格</td>
    <td ><b>数量</td>
    <td ><b>配件</td>
    <td ><b>备注</td>
    <td><b>交货日期</td>
    </tr>
    <tr bgcolor=white ondblclick=add(this)  onmouseout=this.bgColor="" 
    onmouseover=this.bgColor="#ff69b4">
    <td><input  type="text"  name="kh" size="10" style="border:0"></td>
    <td><input  type="text"  name="pm" size="10" style="border:0"></td><td><input  type="text"  
    name="xh" size="10" style="border:0"></td>
    <td><input  type="text"  name="gg" size="10" style="border:0"></td><td><input  type="text"  
    name="shl" size="10" style="border:0"></td>
    <td><input  type="text" name="pj" size="15" style="border:0"></td><td><input  type="text"  
    name="bz" size="20" style="border:0"></td>
    <td><input type="text"  name="jq" size="10" style="border:0"></td>
    </tr>
    </table>
    </span><br>
    <input   type="submit"   value="提 交"  >
    </form></body>
    </html>=======================================================
    index2.asp<%@ Language=VBScript %>
    <!--#INCLUDE FILE="conn.asp" -->
    <%
    txtcontent=trim(request("txtcontent"))Set rs= Server.CreateObject("ADODB.Recordset")
    sql="select * from guestbook"
    rs.open sql,conn,3,2
    rs.addnew                                    

    rs("content")=txtcontent    
    rs("dateandtime")=now()
    rs.update                   
    rs.close

    'response.write "txtcontent"&txtcontentrs.close
    set rs=nothing
    conn.close
    set conn=nothingresponse.redirect "index3.asp"%>========================================
    index3.asp<!--#INCLUDE FILE="conn.asp" -->
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql = "Select * FROM guestbook Order By dateandtime desc"    
    rs.open sql,conn,1,1
    %><table align="center" bgcolor="#cccccc" border="1"  cellpadding="1"  cellspacing="0" bordercolor="black" width="85%"><%do while not rs.eof%><tr>
     <td>
        <table border="1" cellpadding="1"  cellspacing="0" bordercolor="pink" width="100%"><tr><td> 发表于:<%=rs("dateandtime")%> </td></tr>
        </table>
     </td>
    </tr>
    <tr>
      <td><%=rs("content")%></td>
    </tr><%
    rs.movenext
    loop
    %></table><%rs.close
    set rs=nothingconn.close
    set conn=nothing
    %>