473,698 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add option to press Enter key (for Dummies)

2 New Member
I have a form where user enters a password text, then has to click the Submit Password button. How do I add the option to press Enter key to call the same function 'goForit'?

I read similar posts/replies, but I don't know enough to make it work for me. I got this form and script from a free sript site. Trying to learn...thahks in advance for any help.

here is the code:
[html]
<html>
<head>
<SCRIPT LANGUAGE="JavaS cript">
<!-- Begin

function goForit() {
var location;
var password;
password=this.d ocument.testfor m.inputbox.valu e
location=passwo rd + ".asp"
fetch(location)
theKeeper=windo w.close()
}
function fetch(location) {
var root;
if (opener.closed) {
root=window.ope n('','theKeeper sGopher','toolb ar=yes,location =yes,status=yes ,menubar=yes,sc rollbars=yes,re sizable=yes,cop yhistory=no');
root.location.h ref = location;
} else {
opener.location .href = location;
}
}
// End -->
</SCRIPT>
</head>
<body onLoad="top.win dow.focus()" BACKGROUND="ima ges/gatekeeper_mana gers1.jpg">

<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR>
<TD ROWSPAN=2 WIDTH=200px><im g src="../images/clear_1px.gif" width="200px" height="1">
<TD WIDTH=50% ALIGN=CENTER VALIGN=MIDDLE class="maintext " style="color: #ffffff;">
<p>&nbsp;</p>
<p>Please enter your Password. If you do not have one, contact your Manager for
Assistance.
<BR>
</p>
<TR>
<TD WIDTH=50% ALIGN=CENTER VALIGN=BOTTOM>
<p>&nbsp</p>
<CENTER>
<FORM NAME="testform" >
<INPUT TYPE="text" NAME="inputbox" VALUE="" size=20>
<INPUT TYPE="button" NAME="button" Value="Submit Password" onClick="goFori t(this.form)">
</FORM>
</CENTER>
</TABLE>
</body>
</html>
[/html]
<!-- Script Size: 1.71 KB -->
Nov 21 '08 #1
2 3447
RamananKalirajan
608 Contributor
This example may help you.


[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator " CONTENT="EditPl us">
<META NAME="Author" CONTENT="Ramana n">
<META NAME="Keywords" CONTENT="demo Form">
<META NAME="Descripti on" CONTENT="Form Submit">
<script type="text/javascript">
function doValidate()
{
alert("Inside Validate Function");
return false;
}
</script>
</HEAD>

<BODY>
<form action="demoTri al.html" method="post" onsubmit="retur n doValidate()">
<table align="center">
<tr><td>User Name </td><td><input type="text" id="myText" name="myText" /></td></tr>
<tr><td>Passwor d </td><td><input type="text" id="myText1" name="myText1" /></td></tr>
</table>
<input type="submit" value="doSubmit ">
</form>
</BODY>
</HTML>[/HTML]

Instead of using button to submit the form, write a submit input type and trigger the submit function in the form tag. That would do the work what you are looking for.

Regards
Ramanan Kalirajan
Nov 21 '08 #2
donomuch
2 New Member
Ramanan,
Thank you sir. Got it to work.

Darrell
Nov 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
71915
by: JCO | last post by:
How's come when I press the enter key, I can't get it to execute the correct password. It seems that I'm forced to press the button. I want to be able to do both. How is this done?
4
2174
by: penny336 | last post by:
hi here is my original// it can convert to upper case or lower case but require user press "enter" how to implement a without "press enter" version e.g. if input 'a' --> at commad prompt will show 'A' immediately if read '(' it will end. int main() { char input; //char input1; cout<<"Please Enter As mush as you can:";
6
2446
by: Johan Svedberg | last post by:
Hi! I read somewhere that it is impossible to write a program in ANSI-C which only reads one char from the keyboard without having to press Enter (i.e. -questions). Is this true? -- Johan Svedberg, johan@svedberg.pp.se, http://johan.svedberg.pp.se/
5
20876
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number of characters, which are echoed to screen before you have to press enter. For example:- do { /* Begin loop */
6
3738
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many user get used to click "enter" key to submit a form. How can I use "enter" key to submit/postback in ASP.NET. Thank, Guoqi Zheng
16
8044
by: TetoPR | last post by:
Hi, I'm trying to set up an Option Box in a form to feed a Parameter Query to be used as a filter. That field I want to filter is a Text field and has two posible values: "A" and "B". So my Option Box should have three options: "A" ; "B" : and "A" Or "B" (any). Pretty basic stuff. I can't get it to work, for staters it seems that only numbers are allowed as data types for option boxes, and if I try to use a combo box (I'm willing to use...
2
2056
by: Greoasy | last post by:
I have a registration page with no of text boxes and 3 buttons for insert update and delete. and a logout button on the top of the page. If i place my control in an of the text box and press enter key it automatically goes to the logout button and it logouts. Actually when i press the enter key it should avctivate either of the insert,update and delete buttons whchever is active. Please let me know how to do this? How can i overcome this...
1
7014
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 page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
0
8683
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7739
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
6528
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
5862
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.