/    Sign up×
Community /Pin to ProfileBookmark

How do I proceed by pressing "Enter"?

I’m using a JavaScript for my students to “log-in” to website to take online exams. I have a drop-down list for the the username and a text box for the password. One would expect that after entering the password you would press the enter key to proceed, but this doesn’t happen…the screen clears itself and the password field (as if you hit “Reset”). If you press Tab, then Enter, it’ll work. How do I get it to proceed by simply hitting Enter after typing in the password?

THE URL FOR THIS SITE IS: [url]http://www.pearsall.k12.tx.us/exams/[/url]

Here’s the script for the form-

“<form name=login>
<table border=1 cellpadding=3> <table width=225 border=4 cellpadding=5 bgcolor=339933>
<tr><td colspan=2><center><font size=”+1″ font color=FFFF00><b>Authorization Required</b></font></center></td></tr>
<tr><td><font color=FFFFFF><b>Username:</b></font></td><td><select name=memlist>
<option value=’x’>
<option value=’English|61882|GOIMTRGY’>English
<option value=’Math|61882|GWRMEEKR’>Math
<option value=’Science|61882|GWRMEEKR’>Science
<option value=’Social Studies|61882|GWRMEEKR’>Social Studies
</select></td></tr>
<tr><td><font color=FFFFFF><b>Password:</b></font></td><td><input type=password size=10 maxlength=8 name=pass></td></tr>
<tr><td colspan=2 align=center><input type=button value=”Login” onclick=”check(this.form)”><input type=”Reset”></td>
</tr>
</table>
</form>”

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@QuentinNov 08.2006 — Try changing the login button type to submit and adding your onclick event to the onsubmit event for the form and then in your check function if your form fails validation then return false so that the form will stop submittion.

&lt;form name="login" [b]onsubmit="return check(this.form)"[/b]&gt;
&lt;input type=[b]"submit"[/b] value="Login" /&gt;
Copy linkTweet thisAlerts:
@jschendelauthorNov 08.2006 — Nope...still clears the form fields. Any other suggestions??
×

Success!

Help @jschendel spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...