By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

Login script not working

P: 5
Can someone out there tell me why this script(I know-poorly written script) is not working?

[HTML]<html>
<head>
<title>Password</title>

<script language="javascript">
function checkPass()
{
var pBox=window.document.input.loginname.value
var lBox=window.document.input.passworld.value

if(lBox=="Chhaya" ||lBox=="chhaya" || lBox=="niyam" || lBox=="Niyam")
{
if(pBox== "Imemyself" || "yoyo" || "frienship" || "Niyam" || "niyam")
{
alert('Welcome')
window.location = "OnOff.htm"
}
}
if(lBox=="" || pBox == "")
{
if(lBox=="" && pBox==""){alert('please enter the user name and password')}
if(pBox==""){alert("We cannot let you enter without THE PASSWORD or THE LOGINNAME")}
if(pBox=="niyam is the best"){alert(' Nice try')}
}
}
</script>

</head>

<body bgcolor=#feffcc >

<br />
<br />

<form name="input">
<input type="text" name="loginname" value=""><font face="Lucida Handwriting" color=#444444 size=1>Login Name</font>
<br />
<input type="password" name="passworld" value=""><font face="Lucida Handwriting" color=#444444 size=1>Password</font>
<br />
<input type="button" name="Ok" value="All Right" onClick="checkPass()">
<input type="reset" name="NaNa" value="Reset"></input>
</form>

</body>
</html>[/HTML]
Oct 1 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Perhaps pBox and lBox are wrong way round.

In any case, a login script should be coded server-side.
May 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.