js:
function bubufx_enterpress(e) { var keynum; if (window.event) // IE { keynum = e.keyCode; } else if (e.which) // Netscape/Firefox/Opera { keynum = e.which; } if (keynum == 13) { soJS();//回车事件处理脚本 return false; } }
HTML中:
<asp:TextBox ID="TextBox1" runat="server" CssClass="tb" Style="font-size: 18px; width: 300px;
height: 25px;" onkeydown="return bubufx_enterpress(event);" ></asp:TextBox>
兼容firefox,chrome,ie等浏览器。