I have a .js script to allow a v.simple password section to a website it consists of a html from and a .js file it works well however if you press the enter key not the submit button it doesnt work any1 have any idea why please!!!!


html code

<form name="login" method="post" action="">
<table width="300" border="1" cellspacing="0" cellpadding="0" bordercolor="#1d4e91" height="150" bgcolor="#1C86D1">
<tr>
<td valign="bottom">
<table width="300" border="0" cellpadding="0" cellspacing="0" bgcolor="#1C86D1" align="center" height="130">
<tr align="center">
<td height="40">
<div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>Username:</b></font></div>
</td>
<td height="40">
<input type="text" name="username" size="20">
</td>
</tr>
<tr align="center">
<td height="40">
<div align="right"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Password:</b></font></div>
</td>
<td height="40">
<input type="password" name="password" size="20">
</td>
</tr>
<tr align="center">
<td colspan="2" align="center">
<input type="button" value="Login!" onClick="Login()" name="button">
<input type="reset" name="Reset" value="Clear">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>


and in a .js file i have

<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();

if (username=="test" && password=="test") { top.location="http://www.test.co.uk/testindex.html"; done=1; }
if (done==0) { alert("Sorry, Your Log-in is Invalid. Please Try Again."); }
}
// End -->