How to set onclick for default button

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
 
A

Ajay Tripathi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top