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="JavaScript">
<!-- Begin
function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
location=password + ".asp"
fetch(location)
theKeeper=window.close()
}
function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=ye s,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}
}
// End -->
</SCRIPT>
</head>
<body onLoad="top.window.focus()" BACKGROUND="images/gatekeeper_managers1.jpg">
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR>
<TD ROWSPAN=2 WIDTH=200px><img src="../images/clear_1px.gif" width="200px" height="1">
<TD WIDTH=50% ALIGN=CENTER VALIGN=MIDDLE class="maintext" style="color: #ffffff;">
<p> </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> </p>
<CENTER>
<FORM NAME="testform">
<INPUT TYPE="text" NAME="inputbox" VALUE="" size=20>
<INPUT TYPE="button" NAME="button" Value="Submit Password" onClick="goForit(this.form)">
</FORM>
</CENTER>
</TABLE>
</body>
</html>
[/html]
<!-- Script Size: 1.71 KB -->