Kill Event for Enter Key

[Total: 0    Average: 0/5]

This will kill the enter key event.

Head Code:

var isNS =document.appName=="Netscape"?true:false;
var isIE =document.all?true:false;
function keyHandler(e)
 var _ret=true;
 var _char=isIE?event.keyCode:e.which;
 alert("key press:" + _char);
 if(_char==13) /* enter key */
   _ret=false; /* kill event bubler */
 return _ret;
if(isNS)document.captureEvents(Event.KEYPERSS);/*for NS4*/

Body Code:

<form name=f1 action="" method=GET>
<input type=text name=var value="val">
<input type=submit>

Times Viewed: 17

Leave a Reply

Your email address will not be published. Required fields are marked *