473,405 Members | 2,373 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,405 software developers and data experts.

html regular button is triggered with an enter key

I want html regular button is triggered with an enter key. That means, when the user
press ENTER key, it will trigger the event in html regular button. I tried
the following code, and I realized submit button is triggered with an
enter key. But not html regular button. Any workarounds? Please advise. Thanks!!

<INPUT TYPE="button" value="regular button" onClick="alert('button');">
<INPUT TYPE="submit" value="submit button" onClick="alert('submit');">
Jul 23 '05 #1
3 2069
Matt wrote on 27 aug 2004 in comp.lang.javascript:
I want html regular button is triggered with an enter key. That means,
when the user press ENTER key, it will trigger the event in html
regular button. I tried the following code, and I realized submit
button is triggered with an enter key. But not html regular button.
Any workarounds? Please advise. Thanks!!

<INPUT TYPE="button" value="regular button"
onClick="alert('button');"> <INPUT TYPE="submit" value="submit button"
onClick="alert('submit');">


Its all in a name.
<INPUT TYPE="submit" value="regular button"
onClick="alert('button');">

<INPUT TYPE="button" value="submit button"
onClick="alert('submit');return false;">
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
>
<INPUT TYPE="submit" value="regular button"
onClick="alert('button');">

<INPUT TYPE="button" value="submit button"
onClick="alert('submit');return false;">


I added return false in regular button, but when i press enter key, it
still triggers submit button
Jul 23 '05 #3
Matt wrote on 28 aug 2004 in comp.lang.javascript:

<INPUT TYPE="submit" value="regular button"
onClick="alert('button');">

<INPUT TYPE="button" value="submit button"
onClick="alert('submit');return false;">


I added return false in regular button, but when i press enter key, it
still triggers submit button


A button never [well, without a lot of scripting] reacts to an enter key.
A selected <input type=text> enter key submits a form, but does not trigger
a button.

Show your exact code, please, including the <form> and the other <input>s.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #4

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

Similar topics

1
by: Billy Jacobs | last post by:
Is there a way to make a button on a web form the default button so that when the user hits the enter button the code for that button executes? I have a web page Login.aspx where I have only 1...
1
by: Jason | last post by:
I know this is going to be a stupid question, but I'm in a crunch and don't have time to research it as much as I'd like. How do you tell the web form which button is the default button. So if a...
5
by: Alex B | last post by:
A simple web button question: How do you make it so that a web button's click event is triggered when someone hits <enter> on a web form? i.e. the page has three input boxes on it and a web...
2
by: Frank | last post by:
Hi! I have a really 'simple' problem. I have an .aspx page with 2 textboxes (login & password) and a Submit button. This works very well, i fill in my login and password and simply press the...
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...
12
by: SJ | last post by:
Hope someone can help me out there I'm struggling with a particular problem... I have a form with many tab pages. On one tab page I've got a button which when clicked with a mouse adds items...
19
by: darrel | last post by:
On my vb.net page, I have 4 sets of inputs + form buttons. example: Search: (GO) Zip: (GO) County: (GO) County: (GO) The problem is if I go to the page, type in a zip code, and hit...
3
by: graphicsxp | last post by:
Hi, I've written some javascript function so that if a textbox has the focus and the user press enter, it triggers a click on a button 'associated' to this textbox (see code at the end) The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.