这是我的 .html 正文内容:
<form name="login">
<table border="0" cellpadding="2.0" cellspacing="2.0" align="left">
<tr>
<td>Username </td>
<td>
<input name="username" type="text" id="username" maxlength="15"></input>
</td>
</tr>
<tr>
<td>Password </td>
<td>
<input name="password" type="password" id="password" maxlength="10"></input>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<strong>
<input name="Login" type="button" value="Submit" onclick="Vlogin()"></input>
</strong>
</td>
</tr>
</table>
</form>
...和javascript代码:
function Vlogin()
{
var user=document.login.username;
var pass=document.login.password;
if (user.value=="account1" && pass.value=="backup1")
{
window.location= "index.jsp";
}
else
alert("Invalid username or password");
user.focus();
}
}