我的程序中有3个ImageButton2,ImageButton3,ImageButton3,但是我在那个页面中的任何地主都会执行ImageButton2的click事件,我换了button换钮也一样,那个页面是美工用dw做的,我COPY到我的程序的页面中,在程序中没有任何地方有event.keyCode == 13代码,我不明白那窗休中任何地址回车都会执行ImageButton2_click事件,请各位指点一下,老兄我郁闷了二天了

解决方案 »

  1.   

    在表单里表单元素回车的时候,系统都会默认去找第一个type=submit或者type=image的按钮来提交按钮。就这么回事。
      

  2.   

    meizz(梅花雪)老大,那你们在工作中是如何处理类似的问题呀,
      

  3.   

    <asp:ImageButton id="ImageButton1" runat="server" ImageUrl="images/log_btn.gif" tabIndex="1"></asp:ImageButton>
    这个也没有那个type呀,
      

  4.   

    <table class="txt" cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
    <td vAlign="baseline" width="11%" height="20"><font color="#ffffff"><strong>用户名</strong></font></td>
    <td width="24%"><input id="userid" style="HEIGHT: 20px" type="text" maxLength="20" size="12" name="userid"
    runat="server">
    </td>
    <td vAlign="baseline" width="10%"><font color="#ffffff"><strong>密&nbsp;&nbsp;&nbsp;&nbsp;码</strong></font></td>
    <td width="23%"><input id="pswd" style="HEIGHT: 20px" type="password" maxLength="20" size="12" name="pswd"
    runat="server">
    </td>
    <td width="16%"><select style="HEIGHT: 20px" name="select">
    <option selected>·个人</option>
    <option>·企业</option>
    </select>
    </td>
    <td width="16%">&nbsp;
    <asp:ImageButton id="ImageButton1" runat="server" ImageUrl="images/log_btn.gif" tabIndex="1"></asp:ImageButton>
    </td>
    </tr>
    </table>
    具体的html代码如上,请各位帮帮忙,谢谢了,我实在是没办法了
      

  5.   

    自己写javascript脚步捕获keydown==13回车事件。
    http://www.metabuilders.com/Tools/DefaultButtons.aspx
      

  6.   

    http://weblogs.asp.net/rajbk/archive/2003/12/11/43023.aspx
      

  7.   

    你的眼里不要只有服务器端代码!表单的提交动作是在客户端,你在浏览器里查看一下源代码不就可以找到那个 type 了吗!