Sometimes you only want the event is launched by pressing the button rather than the keystrokes, but how? I found this code from Client-side script integration in ASP.net.
<script language="javascript">
<!--
var blnReturn = true;
function trapReturn(e)
{
var iKeyCode = 0;
if (window.event) iKeyCode = window.event.keyCode;
else if (e) iKeyCode = e.which;
blnReturn = (iKeyCode != 13);
}
// -->
</script>
and add the two event handler attributes to the form tag on the web page:
<form id="default" runat="server" onkeypress="trapReturn(event);" onsubmit="return blnReturn;">
However, it seems that it traps the mouse event as well. It had no response while I hit the button by click the mouse left button. So I added the third event handler attribute to the form tag, onmousedown="blnReturn=true;", which works great.