•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 363,508 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,418 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3773 | Replies: 2
![]() |
Dear Friends..
I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? "
I use javacript for validation..Is there anything do with javascript in this regard..?
Regards,
Balaguru
I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? "
I use javacript for validation..Is there anything do with javascript in this regard..?
Regards,
Balaguru
Re: How to fire a HTML button by default when enter key is pressed using javascript..?
#2
Sep 5th, 2007
Just make your 'OK' button of type 'submit' and you should be good to go. Its probably the easiest way of achieving the desired task. Other options include capturing the keyboard event, checking whether a RETURN key has been pressed and handling it accordingly. This approach is best avoided unless you have some weird requirement in which you can't make the 'OK' button of type submit.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
Join Date: Sep 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Re: How to fire a HTML button by default when enter key is pressed using javascript..?
#3
Sep 11th, 2007
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
activation ajax apple asp battery code cracked css developer development div dreamweaver fire firefox gates google checkout google checkout vat hack home html html api internet ipod javascript key kms management melinda microsoft msdn news office product registration serial service site software sql symantec tables vista w3c web wysiwyg xml
- Detecting any key being pressed. (VB.NET)
- enter key (VB.NET)
- Capture the Enter Key in an Edit Control (C++)
- Problem with Keyboard Event <Enter> Key (JavaScript / DHTML / AJAX)
- I need to be able to hit Enter as well as clicking button. (VB.NET)
- how to get the last key pressed without stopping the programm ? (C)
- Help need with Socket, Thread, and BufferedReader (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: how to use javasript in .net
- Next Thread: file or database processing in javascript



Linear Mode