User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Apr 2007
Posts: 26
Reputation: BalagurunathanS is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
BalagurunathanS's Avatar
BalagurunathanS BalagurunathanS is offline Offline
Light Poster

How to fire a HTML button by default when enter key is pressed using javascript..?

  #1  
Sep 5th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,696
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 314
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

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."
Reply With Quote  
Join Date: Sep 2007
Posts: 4
Reputation: sandeep.mk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sandeep.mk sandeep.mk is offline Offline
Newbie Poster

Re: How to fire a HTML button by default when enter key is pressed using javascript..?

  #3  
Sep 11th, 2007
hi

which company u r working for, where

and balu,

how can i disable/enable mouse right click options


regards
sandeep.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC