Detect Enter Key Press - Workable with firefox

It take me about 3-4 hours just to find out this code. Because there is a bit diff for IE to detect the keyboard key press with firefox.

 

Finally I found the code and it working fine for my firefox.

 

<script type="text/javascript" language="JavaScript">

function checkCR(e) {

var Key=e.keyCode? e.keyCode : e.charCode;

       if( Key == 13){

        alert("You press enter button");
        }

}

</script>

<input type="text" name="txtEnterPageNo" id="txtEnterPageNo" size="3" onkeypress="checkCR(event);">

Post a Comment