Click to See Complete Forum and Search --> : Why doesnt this work?


wildwobby
06-08-2003, 04:45 PM
<HEAD>
<SCRIPT language="JavaScript">
<!--hide

var password;
var nom;

var pass1="somthing";
var name1="Robby";

alert=(' Passwords and names are CaSe SeNsItIvE so john doe is not the same as John doe or John Doe');
password=prompt('Please enter your password to view this page!',' ');
nom=prompt('Please enter your name here!',' ');

if (password==pass1) && (nom==name1)+
alert('Password Correct! Click OK to enter!');
else
alert(' you'r passwoord or name is inncorect! sign up to be given a password or username!')
{
window.location="http://www.geocities.com/wildwobby.htm";
}

//-->
</SCRIPT>
</HEAD>

pyro
06-08-2003, 04:53 PM
Javascript passwords are very insecure. You'd be far better off doing this server side (PHP, CGI/Perl, ASP, etc). Anyway, try this out (fixed the various syntax errors):

<script type="text/javascript">

var password;
var nom;

var pass1="somthing";
var name1="Robby";

alert(' Passwords and names are CaSe SeNsItIvE so john doe is not the same as John doe or John Doe');
password=prompt('Please enter your password to view this page!',' ');
nom=prompt('Please enter your name here!',' ');

if (password==pass1 && nom==name1) {
alert('Password Correct! Click OK to enter!');
}
else {
alert(' your passwoord or name is inncorect! sign up to be given a password or username!');
window.location.href="http://www.geocities.com/wildwobby.htm";
}

</script>

pyro
06-08-2003, 05:03 PM
lol.. yeah, I changed you'r to your because that was a syntax error :D... I also assumb that var pass1="somthing"; should have been var pass1="something"; ;)

wildwobby
06-08-2003, 05:23 PM
<HEAD>
<SCRIPT language="JavaScript">
<!--hide

var password;
var nom;

var pass1="something";
var name1="Robby";

alert=(' Passwords and names are CaSe SeNsItIvE so john doe is not the same as John doe or John Doe');
password=prompt('Please enter your password to view this page!',' ');
nom=prompt('Please enter your name here!',' ');
if ((password==pass1) && (nom==name1))
alert('Password Correct! Click OK to enter!');
else
alert('you\'r passwoord or name is inncorect! sign up to be given a password or username!')

{
window.location="http://www.geocities.com/wildwobby.htm";
}

//-->
</SCRIPT>
</HEAD>

pyro
06-08-2003, 05:36 PM
Please try the code that I posted...

pyro
06-08-2003, 06:59 PM
Lol... True. I should have just made the syntax changes and left it at that... :p