HTML表单标签正在IE上占用新的td空间

时间:2011-08-29 06:57:38

标签: html html5

我正面临浏览器问题。我需要创建两个“形式”,其中存在<td>。但问题是,在创建第二个“表单”后,<td>会转到新行。此问题仅适用于Internet Explorer而非Firefox。

代码如下:

<form name="myform" action="registerUser" onsubmit="return verifyEmail();" method="post">

<tr>
<td align="left" valign="top" style="padding-left:2px;">
    <%
            String emailAddress = request.getParameter("emailAddress");
        %>
        <input class="sign-in-textbox" name="emailAddress" id="emailAddress" onfocus="clearMessage(this,'Enter your work email address');" value="Enter your work email address" onblur="fillMessage(this,'Enter your work email address');"/>
        <br/>
</td>

</tr> 
<tr>
<td align="left" valign="top" style="padding-top:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="49%" align="left" valign="middle"  style="padding-top:2px;">
    <input type="submit" class="p-signinbutton" id="register" value="Join" width="78"/>
    </td>
     </form>
     <form name="continueAsGuest" action="guestLogin.do" onsubmit="return continueAsGuest();" method="get">
    <td width="50%" align="left" valign="middle"><input type="submit" class="p-signinbutton" id="continueAsGuest" value="Continue as Guest" width="85"/></td>

  </tr>
</table>
</tr>
</form>

1 个答案:

答案 0 :(得分:0)

HTML无效。尝试在表格元素中移动表单标记。第二种形式很容易修复:

<td width="50%" align="left" valign="middle">
    <form name="continueAsGuest" action="guestLogin.do" onsubmit="return continueAsGuest();" method="get">
    <input type="submit" class="p-signinbutton" id="continueAsGuest" value="Continue as Guest" width="85"/>
    </form>
</td>

第一个更难生效,但如果您将<form>标记放在第一个<td>内,</form>标记位于前一个{{1}之内,则可能会有效1}}。