K
kev
Hi,
Am using java script for a mini site. what is my problem is , once am
selecting a user name from the list, and then typing a password, when
a user press enter button, it is not taking .....
user have to manually use mouse to click the submit button...
can i make it easy for the user by pressing the enter button??
Please help....
Here is the code//////
form part of my file.........
<center><form name=login >
<table border=1 cellpadding=3>
<tr><td colspan=2 align=center><font size="+2"><b>Members-Only Area!</
b></font></td></tr>
<tr><td>Username:</td><td><select name=memlist>
<option value='x'>
<option value='John Smith|42691|NGLOQEMM'>John Smith
<option value='Peter Jones|52219|GNLVAPMV'>Peter Jones
<option value='Sue Brown|18215|PXAPGWKY'>Sue Brown
<option value='Sally West|64403|NUIRTURT'>Sally West
<option value='John|16419|VHYZAJUV'>John
</select></td></tr>
<tr><td>Password:</td><td><input type=password size=10 maxlength=8
name=pass></td></tr>
<tr><td colspan=2 align=center><input type="button"name= submit
value="Submit" onclick="check(this.form);" ></td>
</tr>
</table>
</form>
if u want the entire file....here it goes.........
<html>
<title>a</title>
<head>
</head>
<body>
<center><form name=login >
<table border=1 cellpadding=3>
<tr><td colspan=2 align=center><font size="+2"><b>Members-Only Area!</
b></font></td></tr>
<tr><td>Username:</td><td><select name=memlist>
<option value='x'>
<option value='John Smith|42691|NGLOQEMM'>John Smith
<option value='Peter Jones|52219|GNLVAPMV'>Peter Jones
</select></td></tr>
<tr><td>Password:</td><td><input type=password size=10 maxlength=8
name=pass></td></tr>
<tr><td colspan=2 align=center><input type="button"name= submit
value="Submit" onclick="check(this.form);" ></td>
</tr>
</table>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var params=new Array(4);
var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
function check(form) {
which=form.memlist.selectedIndex;
choice = form.memlist.options[which].value+"|";
if (choice=="x|") {
alert("Please Select Your Name From The List");
return;
}
p=0;
for (i=0;i<3;i++) {
a=choice.indexOf("|",p);
params=choice.substring(a,p);
p=a+1;
}
h1=makehash(form.pass.value,3);
h2=makehash(form.pass.value,10)+" ";
if (h1!=params[1]) {
alert("Incorrect Password!"); return; };
var page="";
for (var i=0;i<8;i++) {
letter=params[2].substring(i,i+1)
ul=letter.toUpperCase();
a=alpha.indexOf(ul,0);
a-=(h2.substring(i,i+1)*1);
if (a<0) a+=26;
page+=alpha.substring(a,a+1); };
top.location=page.toLowerCase()+".html";
}
function makehash(pw,mult) {
pass=pw.toUpperCase();
hash=0;
for (i=0;i<8;i++) {
letter=pass.substring(i,i+1);
c=alpha.indexOf(letter,0)+1;
hash=hash*mult+c;
}
return(hash);
}
// End -->
</script>
</center>
</body>
</html>
if u r trying to run this file as live, find out the following info ::
User name: John Smith
password is : password
file name in the same folder : mainpage.html
process:
once user name and password is selected, and once submit button
clicks, it will take you to mainpage.html......
Hope u got it....
let me know anything more if u needed....
and please
Please help./.
Am using java script for a mini site. what is my problem is , once am
selecting a user name from the list, and then typing a password, when
a user press enter button, it is not taking .....
user have to manually use mouse to click the submit button...
can i make it easy for the user by pressing the enter button??
Please help....
Here is the code//////
form part of my file.........
<center><form name=login >
<table border=1 cellpadding=3>
<tr><td colspan=2 align=center><font size="+2"><b>Members-Only Area!</
b></font></td></tr>
<tr><td>Username:</td><td><select name=memlist>
<option value='x'>
<option value='John Smith|42691|NGLOQEMM'>John Smith
<option value='Peter Jones|52219|GNLVAPMV'>Peter Jones
<option value='Sue Brown|18215|PXAPGWKY'>Sue Brown
<option value='Sally West|64403|NUIRTURT'>Sally West
<option value='John|16419|VHYZAJUV'>John
</select></td></tr>
<tr><td>Password:</td><td><input type=password size=10 maxlength=8
name=pass></td></tr>
<tr><td colspan=2 align=center><input type="button"name= submit
value="Submit" onclick="check(this.form);" ></td>
</tr>
</table>
</form>
if u want the entire file....here it goes.........
<html>
<title>a</title>
<head>
</head>
<body>
<center><form name=login >
<table border=1 cellpadding=3>
<tr><td colspan=2 align=center><font size="+2"><b>Members-Only Area!</
b></font></td></tr>
<tr><td>Username:</td><td><select name=memlist>
<option value='x'>
<option value='John Smith|42691|NGLOQEMM'>John Smith
<option value='Peter Jones|52219|GNLVAPMV'>Peter Jones
</select></td></tr>
<tr><td>Password:</td><td><input type=password size=10 maxlength=8
name=pass></td></tr>
<tr><td colspan=2 align=center><input type="button"name= submit
value="Submit" onclick="check(this.form);" ></td>
</tr>
</table>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var params=new Array(4);
var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
function check(form) {
which=form.memlist.selectedIndex;
choice = form.memlist.options[which].value+"|";
if (choice=="x|") {
alert("Please Select Your Name From The List");
return;
}
p=0;
for (i=0;i<3;i++) {
a=choice.indexOf("|",p);
params=choice.substring(a,p);
p=a+1;
}
h1=makehash(form.pass.value,3);
h2=makehash(form.pass.value,10)+" ";
if (h1!=params[1]) {
alert("Incorrect Password!"); return; };
var page="";
for (var i=0;i<8;i++) {
letter=params[2].substring(i,i+1)
ul=letter.toUpperCase();
a=alpha.indexOf(ul,0);
a-=(h2.substring(i,i+1)*1);
if (a<0) a+=26;
page+=alpha.substring(a,a+1); };
top.location=page.toLowerCase()+".html";
}
function makehash(pw,mult) {
pass=pw.toUpperCase();
hash=0;
for (i=0;i<8;i++) {
letter=pass.substring(i,i+1);
c=alpha.indexOf(letter,0)+1;
hash=hash*mult+c;
}
return(hash);
}
// End -->
</script>
</center>
</body>
</html>
if u r trying to run this file as live, find out the following info ::
User name: John Smith
password is : password
file name in the same folder : mainpage.html
process:
once user name and password is selected, and once submit button
clicks, it will take you to mainpage.html......
Hope u got it....
let me know anything more if u needed....
and please
Please help./.