I'm trying to set up a form that allows you enter a password that grants access to a specific URL.
For example, enter "facebook", and it takes you to www.facebook.com Enter, "yahoo", it sends you to www.yahoo.com Enter, "google",.... you get it. If one enters anything but those words, it gives an error.
This is what I have so far:
<script language="javascript">
<!--//
/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if(form.id.value=="google") { location="http://www.google.com" }
else if(form.id.value=="facebook") { location="http://www.facebook.com" }
else if(form.id.value=="yahoo") { location="http://www.yahoo.com" }
else {alert("Invalid Password")}
}
//-->
</script>
<form name="login">
<input name="id" type="text">
<input type="button" value="Enter Class" onClick="pasuser(this.form)">
</form>
However, this doesn't work! Can someone help me set this up! I'd really like to have more than 3 options.
Thanks!
onClickshould beonclick