Monday, July 26, 2004

How to prevent Page being submitted when Enter key is pressed.

Hi,
Call This Function in onKeyPress event of any control.
function onKey()
{
if ((event.which && event.which == 13) (event.keyCode &&
event.keyCode == 13))
{document.myForm.myHtmlInputButton.click();return false;}
else return true;
}

 for more detail you can go through with http://www.allasp.net/enterkey.aspx.

For All Page document.onkeypress = function(){return event.keyCode!=13;};


Regard's




No comments: