2013-03-07 72 views
1

我含有1和主表2个2表中的下面的HTML页面。HTML行距不正确

<%-- 
    Document : P2 
    Created on : Mar 7, 2013, 1:19:55 PM 
    Author  : u0138039 
--%> 
<!DOCTYPE html> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>JSP Page</title> 
    </head> 
    <body> 
     <form name="form1" method="post" action=""> 
      <table width="722"> 
      <tr> 
       <td width="334"> 
       <table width="255" > 
       <tr> 
        <td width="128"><p>PARTS Updated&#13;</p></td> 
        <td width="111"><label for="PARTS_Updated"></label> 
        <select name="PARTS_Updated" id="PARTS_Updated" > 
         <option value=""></option> 
         <option value="N/A">N/A</option> 
        </select></td> 
       </tr> 
       <tr> 
        <td><p>TSI OK&#13;</p></td> 
        <td><label for="TSI_OK"></label> 
        <select name="TSI_OK" id="TSI_OK"> 
         <option value="N/A">N/A</option> 
         <option value="TSI Query">TSI Query</option> 
        </select></td> 
       </tr> 
       <tr> 
        <td><p>Special Ins OK&#13;</p></td> 
        <td><label for="Special_Ins_OK"></label> 
        <select name="Special_Ins_OK" id="Special_Ins_OK"> 
         <option value="N/A">N/A</option> 
         <option value="SI Query">SI Query</option> 
        </select></td> 
       </tr> 
       </table></td> 
       <td width="376"><table width="279" align="center" height="44"> 
       <tr> 
        <td width="87"><p>Shipment ID&#13;</p></td> 
        <td width="97"><label for="Ship_ID"></label> 
        <input type="text" name="Ship_ID" id="Ship_ID"></td> 
       </tr> 
       </table></td> 
      </tr> 
      </table> 
     </form> 
     <h1>&nbsp;</h1> 
    </body> 
</html> 

当我注释掉以下部分

<%-- 
    Document : P2 
    Created on : Mar 7, 2013, 1:19:55 PM 
    Author  : u0138039 
--%> 

我收到表,因为我想要的,但是当我取消注释行空间是变化的,即它正在增加。请让我知道如何使该行的空间缩小和评论上述部分。

感谢

+0

为什么body标签之外本节......? – 2013-03-07 08:57:48

回答

0

检查这个代码:

<%-- Part 1 (Replace % with ! for HTML comment) 
    Document : P2 
    Created on : Mar 7, 2013, 1:19:55 PM 
    Author  : u0138039 
--> 
<!DOCTYPE html> 
<%-- Part 2 (Replace % with ! for HTML comment) 
    Document : P2 
    Created on : Mar 7, 2013, 1:19:55 PM 
    Author  : u0138039 
--> 

<html> 
<head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>JSP Page</title> 
</head> 
<body> 
    <form name="form1" method="post" action=""> 
     <table width="722" border=1> 
     <tr> 
      <td width="334"> 
      <table width="255" border=1> 
      <tr> 
       <td width="128"><p>PARTS Updated&#13;</p></td> 
       <td width="111"><label for="PARTS_Updated"></label> 
       <select name="PARTS_Updated" id="PARTS_Updated" > 
        <option value=""></option> 
        <option value="N/A">N/A</option> 
       </select></td> 
      </tr> 
      <tr> 
       <td><p>TSI OK&#13;</p></td> 
       <td><label for="TSI_OK"></label> 
       <select name="TSI_OK" id="TSI_OK"> 
        <option value="N/A">N/A</option> 
        <option value="TSI Query">TSI Query</option> 
       </select></td> 
      </tr> 
      <tr> 
       <td><p>Special Ins OK&#13;</p></td> 
       <td><label for="Special_Ins_OK"></label> 
       <select name="Special_Ins_OK" id="Special_Ins_OK"> 
        <option value="N/A">N/A</option> 
        <option value="SI Query">SI Query</option> 
       </select></td> 
      </tr> 
      </table></td> 
      <td width="376"><table width="279" align="center" height="44" border=1> 
      <tr> 
       <td width="87"><p>Shipment ID&#13;</p></td> 
       <td width="97"><label for="Ship_ID"></label> 
       <input type="text" name="Ship_ID" id="Ship_ID"></td> 
      </tr> 
      </table></td> 
     </tr> 
     </table> 
    </form> 
    <h1>&nbsp;</h1> 
</body> 
</html> 

案例1:如果评论 “第1部分” 和 “第2部分”。然后: enter image description here

情况2:如果取消注释“Part1”并评论“Part2”。然后: enter image description here

案例3:如果您评论“Part1”并取消注释“Part2”。然后: enter image description here

因为“DOCTYPE HTML”声明是什么版本的HTML的网页上写的是Web浏览器的指令

在情况2的第一行是不是这个“DOCTYPE HTML”这样的网络浏览器无法知道HTML的版本,所以它不能够休息标记格式。

在情形3的第一行是该“DOCTYPE HTML”这样的网络浏览器能够知道HTML的版本,所以它能够在其他标记格式。所以我们得到格式化的表格。

+0

谢谢哥哥这个工作 – 2013-03-07 09:35:40

+0

@拉克什 - marsonio - 不客气:) – 2013-03-07 10:58:34

+0

兄弟可以请你看看这个帖子http://stackoverflow.com/questions/15269516/unable-to-get-elements-passed-来自-html -thanks – 2013-03-07 11:07:56