How to set onclick for default button

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

Hi

I have asp.net web app. When a user clicks the enter key when he is viewing
the aspx web form, it jumps to the starting web form. How can I handle the
user hitting the enter key and to redirect it to a default button. So lets
say that I have a button name - Submit - if the user clicks anywhere in the
form on the enter key I want it to default to a click on the 'Submit' button
which is an asp.net button.


Thanks,
Ron
 
Do this in you r/javascript function hooked to any where
on textbox etc.

function abc()
{
if(window.event.keyCode == '13')
{
document.getElementById(yoursubmitnuttonid).click
();
event.returnValue = false;
}
}

event.returnvalue is for avoiding beep sound.

Happy programming..
Ajay
 
Back
Top