我试图把登录凭据来访问我的网页时无法显示: 我的login.html页使用的登录页面,但的代码显示
<html>
<head>
<title>Please type your Username and Password... </title>
<script language="JavaScript" type="text/JavaScript" src="login.js"></script>
</head>
<body bgcolor="#eeeeee">
<form>
<br>
<center>
Username: <input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';">
<br>
Password: <input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';">
<br>
<input type="button" value="Login" onClick="Login(this.form);" style="background:#bfbfbf;color:#000000;border-color:#212121;" onMouseOver="this.style.color = '#404040';" onMouseOut="this.style.color = '#000000';" onFocusr="this.style.color = '#404040';" onBlur="this.style.color = '#000000';">
</center>
</form>
</body>
</html>
写了这个,我写这个JS的登录。 js
function Login(form) {
username = new Array("u1","u2");
password = new Array("p1","p2");
page = "untitled_1" + ".php";
if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1])
{
self.location.href = page;
} else {
alert("Either the username or password you entered is incorrect.\nPlease try again.");
form.username.focus();
}
return true;
}
因此,当我打开页面时,我输入凭据,然后登录。浏览器显示的页面“untitled_1.php”所有的PHP和HTML代码,而不是页面:(的代码
帮助请!
我衷心希望您不打算在任何实际应用程序中使用此登录过程。 –
'page =“untitled_1”+“.php”;'??? – alfasin
@alfasin untitled_1.php是登录后必须重定向到的网页 – user1424394