PDA

View Full Version : Easy Javascript password help


Killinger
07-08-2004, 10:43 PM
Hey guys, I need help with a password. The if and else commands are switched for some reason. Heres the code
<script language="javascript">
function One()
{
var password=prompt("Please Enter Password")
if (password !="pass")
(location="http://www.htmlgoodies.com")
else (location="http://www.htmlsucks.com")
}
</script>
<BODY BGcolor="#ffffff" onLoad="One()">
when you enter pass it goes to htmlsucks.com, but when you enter something else, it goes to htmlgoodies.com when it should be the other way around. Thanks in advance!

agent002
07-09-2004, 01:21 AM
Hi Killinger, welcome to HTMLForums! :)
The problem with that script is that anyone can view the source and get the password from there. This issue is just being discussed in another thread, so please have a look here: http://www.htmlforums.com/showthread.php?s=&threadid=42470