473,804 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2091
Matt wrote on 27 aug 2004 in comp.lang.javas cript:
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');retur n 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');retur n 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.javas cript:

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

<INPUT TYPE="button" value="submit button"
onClick="alert( 'submit');retur n 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
6397
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 button on the form. When the user hits enter the button is clicked. I have a second page mycsepp.aspx which has an asp button and a link button. When I hit enter neither of the button click events are triggered. If I tab to one of them and
1
977
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 user fills out the form and hits enter instead of clicking the submit button, the correct button gets triggered. In other words I have a web form with a cancel button and a submit button and when I go into the form the and fill it out and hit...
5
216
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 button. When enter is pressed, a postback occurs, but no events are triggered.
2
2061
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 enter key and the form submits and the Button_Click event on the .aspx page is triggered. Now i also have a usercontrol (.ascx) wich include 1 texbox and also an submit button. Now comes the problem. The page displays correct,
20
5666
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 client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
12
7390
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 into a datagrid. When a user presses the enter key on this button I want the mouse click event to be activated but instead the tab page's validating event is called. I understand that this behaviour is by partly by design (Accept button etc) but I...
19
2214
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 enter.
3
1563
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 javascript works fine. If I'm in txtJournalist2 and I press enter, the OnClick Server event of btnAuthor2 is triggered. But the problem is that for some reason, the OnClick Server event of btnAuthor is also triggered afterward (not from the...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9175
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.