473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

trigger HTML button by enter ENTER key

<input type="button" onClick="doSomething()">

When the user click HTML button, it will launch doSomething(). But I
want the user enter ENTER key, it will have same effect.

Please advise. Thanks!
Jul 20 '05 #1
1 7495
On 6 Mar 2004 08:12:38 -0800, Matt <jr********@hotmail.com> wrote:
<input type="button" onClick="doSomething()">

When the user click HTML button, it will launch doSomething(). But I
want the user enter ENTER key, it will have same effect.


If the button has focus, pressing enter will invoke an onclick event. If
some other control (in a form) has focus, the form's submit button will
receive the event.

As I see it, if you do want to invoke an event on an arbitrary control,
you'll have to handle the onkeydown event on *every* control that might be
active when Enter is pressed and fire the event yourself. That's a lot of
work.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: .pd. | last post by:
Hi, I've got a textbox and button and when the user presses Enter in the textbox, I want the button's click event to fire. I've got as far as using the KeyPress event to check for the Enter...
2
by: kj | last post by:
How does one trigger an event programmatically? I'm interested in how to do this in both the "Level 0" event model as well as in the DOM Level 2 event model. Thanks! kj -- NOTE: In my...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
1
by: ramalingam | last post by:
Hi I am very new to PHP. Please help. I have a HTML code in a php file which takes in USERID and password. I have <input name="Submit" type="button" value="Submit" onClick="funCheck()"/>,...
1
by: zhengyan11 | last post by:
Hey, what I try to do is when a user clicked an image button on my site, I use onClick to trigger a dialog box and at the same time I use button.attach("onClick", savecookie) to mark this...
1
by: koraykazgan | last post by:
Hi all, I have a user control (ASCX). In that user control there is a panel, and inside that panel there is a textbox and a button. The panel has a DefaultButton property set, which is set to the...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: kenneth6 | last post by:
msvc++: on windows form, there is a button and textbox. the button takes in the text from textbox to further the process. how can i allow user to press enter key in textbox to trigger the...
6
by: Mark B | last post by:
I have a function that looks up a SQL table to see if a search term matches. It works fine but so far there are two things yet to work: 1) After entering a search term and pressing Enter, nothing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.