修改如下..試試看可不可以用
複製程式
<html>
<head>
<title>Login Screen</title>
<Script Language="JavaScript">
function Login()
{
var strUsername = document.tblMain.username.value
var strPassword = ""
if (strUsername.length==0) strPassword = "no"
for (var i=1; i<strUsername.length; i++)
{
strPassword += strUsername.substring(strUsername.length-i, strUsername.length-i+1)
}
strPassword += strUsername.substring(0, 1)
if (document.tblMain.username.value==strUsername && document.tblMain.password.value==strPassword)
{alert("Hello " + strUsername + " !")}
else
{alert("Error")}
}
</Script>
</head>
<body>
<form name="tblMain">
<table width="65%" height="100%" border="0" align="center">
<tr>
<td width="40%"><p align="center">Enter your username: </p>
<p align="center">
<input type = "text" name ="username">
</p>
<p align="center">Enter your password:</p>
<p align="center">
<input type = "password" name ="password">
</p>
<p align="center">
<input type = "button" name ="btnLaunch" value ="Launch" onClick="Login()">
</p></td>
<td width="60%"><img src="Login/Login_Rocket.jpg" width="200" height="300"></td>
</tr>
</table>
</form>
</body>
</html>