473,472 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hitting the enter key

2 New Member
The website i am running for our fraternities local website has a password page. and after inputing the proper password you have to actually click on the enter button....

How can i get it so all u have to do is hit the enter key on the keyboard?

here is the website...... if you click on the brothers only link on the side u will see where its at.

http://studentorg.stcloudstate.edu/pkt/
Oct 3 '08 #1
4 1517
Markus
6,050 Recognized Expert Expert
I guess it depends what browser you are using. You know, with that big ol' 'submit' button there, I don't think your frat brothers will be too stumped on submitting the password.
Oct 3 '08 #2
marine33
2 New Member
yea its not really a matter of a problem just makes the page easier to use. we all know to click on it. Was just trying to find out a way to get it so all u have to do is hit the enter key. I have gone on it many times and every now and then just hit enter because im used to doing it on so many other pages.
Oct 3 '08 #3
JamieHowarth0
533 Recognized Expert Contributor
Hi there,

It's a case of capturing the event when a key is pressed, checking to see if it's the Enter key, and submitting the form, right?
Try adding this to your form:
Expand|Select|Wrap|Line Numbers
  1. <form onkeypress="checkSubmit(event)">
  2.  
And in the head of your document, add this:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript>
  2. <!--
  3. function checkSubmit(e)
  4.  
  5. if (window.event) { //For IE
  6.    switch (e.keyCode) {
  7.         case 13:
  8.             document.myform.submit();
  9.             return true;
  10.             break;
  11.         default:
  12.             return false;
  13.             break;
  14.     }
  15. } else if (e.which) {
  16.    switch (e.which) {
  17.         case 13:
  18.             document.myform.submit();
  19.             return true;
  20.             break;
  21.         default:
  22.             return false;
  23.             break;
  24.     }        
  25. }
  26. //--></script>
  27.  
Replace myform with the name of your form in the above code and it should work fine.
The above code is provided with a little help from W3Schools.

Hope this helps.

medicineworker

P.S. I moved your thread to the Javascript forum cause the answer is JS-based.
Oct 4 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
By default, both Firefox and IE will submit the form if you're still focused on the text box and press the enter key.
Oct 4 '08 #5

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

Similar topics

1
by: ritelman | last post by:
Hi I have one text field and one submit button. If I hit the submit button with a mouse the key/value pair key are properly submitted. However, if I just hit the enter key the page does get...
3
by: Megha Vishwanath | last post by:
Hi, I have a struts form <html:form> in which although the focus rests on the submit button, hitting the enter key does not submit the form. I tried capturing the Enter key event and followed...
2
by: 23s | last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm in either of those textboxes (i.e., either one of the textboxes has focus), in any given browser, hitting "enter" on my...
6
by: Paul Furman | last post by:
I'm getting incorrect response when hitting the enter key instead of actually clicking the button on a form. It activates but the post data isn't being sent I think. The php generated page...
2
by: Sunfire | last post by:
I was wondering if there was a way to hit enter to insert blank lines while in the designer? I tried this but all it seems to want to do is insert code that really shouldn't be there. For example,...
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
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,...
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...
1
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...
0
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...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.