View Full Version: Javascript Help

EV Forums > Web Help > Javascript Help



Title: Javascript Help


Cyndaquil201 - September 17, 2007 01:16 PM (GMT)
Okay. I've been trying to make a password thing with Javascript where you can enter a password and it redirects you somewhere. Just a normal password thing. I made it using alerts, but I don't like alerts that much, so I decided to use a form.

It worked fine, except, instead of redirecting me, the url changed from this:

testing.html

to this:

testing.html?password=blahblah

and I have no idea what to do.

This is my code:

CODE

<html>
<head>

<script type="text/javascript">
<!--
function testing()
{
var password;
var pass1 = "rirrel";
var pass2 = "ineedtotestthis";

if (password=pass1) {
window.location = "rirrel.html";
}
else if (password=pass2) {
window.location = "password.html";
}
else {
alert("Incorrect.")
}
}
// -->
</script>
</head>
<body>
<form onsubmit="testing()">
<p><b>Password:</b> <input type="text" name="password">
<br>
<input type="submit" value="Submit">
</p>
</form>
</body>
</html>




Hosted for free by InvisionFree