2010-07-30 91 views
0

我希望文本框和“应用”按钮位于直线上。我究竟做错了什么?javascript对齐在一条线上

<tr align = "center" valign ="bottom"> 
    <td align="left" style="padding-top: 15px; height: 30px;"> 
     Promo Code</br><asp:TextBox ID="txtCouponCode" runat="server" MaxLength="10" TabIndex="5" Width="130px" /> 
<asp:ImageButton ID="ImageButton1" ImageUrl="../images/apply-blue.gif" runat="server" 
    OnClick="imgApply_Click" ValidationGroup="0"/> 
+0

hightlight你的代码,然后点击小010101图标,所以你得到的代码格式:) – 2010-07-30 17:04:31

+0

你的意思是,当它在浏览器呈现他们不在同一行? – Josh 2010-07-30 17:05:34

+0

你能展示呈现的HTML吗? – hunter 2010-07-30 17:06:36

回答

0

除了未成年人问题与畸形BREAK标签:

</br>应该是<br />

...并假设你是在事实上关闭了你的表行和表数据的标签。然后您摘录:

<tr align = "center" valign ="bottom"> 
    <td align="left" style="padding-top: 15px; height: 30px;"> 
     Promo Code<br /><asp:TextBox ID="txtCouponCode" runat="server" MaxLength="10" TabIndex="5" Width="130px" /> 
<asp:ImageButton ID="ImageButton1" ImageUrl="../images/apply-blue.gif" runat="server" 
    OnClick="imgApply_Click" ValidationGroup="0"/> 
    </td> 
</tr> 

应该大致产生以下HTML:

<tr align="center" valign="bottom"> 
    <td align="left" style="padding-top: 15px; height: 30px;"> 
     Promo Code<br /><input name="txtCouponCode" type="text" maxlength="10" id="txtCouponCode" tabindex="5" style="width:130px;" /> 
     <input type="image" name="ImageButton1" id="ImageButton1" src="../images/apply-blue.gif" /> 
    </td> 
</tr> 

这应该呈现正是你想要的方式。所以...你能提供一些更多的上下文吗?

+0

嘿,我已经使用Imagealign =底部,它的工作..非常感谢这些家伙! – Ram 2010-07-30 18:18:43

0

它现在怎么样,一个在另一个之上?

尝试添加NOWRAP属性到表即<td align=left nowrap>

当心帖子斥责你使用表格布局的目的的进洪!