I really need help, the code underneith is pretty confising. I have commented where i need the help. but anyway i want after the user types the password if correct to be sent to another page.

function passCheck() {

var atoz = new Array ("m","b","q","d","e","l","g","h","i","j","k",".","m","t","b","q","r","s","t","u","v","/","x","y","z")
var colin;


var d=atoz[11];var h=atoz[7];var t=atoz[13];var m=atoz[0];var l=atoz[5];
var sint= d + h + t + m + l;

var p=atoz[6];var a=atoz[12];var s=atoz[18];var e=atoz[20];


if (document.input.password.value == p + a + s + e)
//i need a statment here to redirect my user to a different page called gmtv.html//
else
alert
("incorrect")
}

</script>

</head>
<body>


<form name="input">
Name: <input type="text" name="username" onchange="javascript:this.value = this.value.toLowerCase();"/>
<br />
Password : <input type="password" name="password" onchange="javascript:this.value = this.value.toLowerCase();" /><br />
<input type="submit" onclick="passCheck()" />
</form>

</body>
</html>

any ideas

Recommended Answers

All 2 Replies

Use the replace function or the href property of the location object to do the same.

if (document.input.password.value == p + a + s + e)
{
    /* assuming the the file resides on the same path */
    location.replace('gmtv.html'); 
    /* or use location.href = 'gmtv.html' */
}
else
{
    alert("incorrect");
}

Realize that any user can look at the code and find out the password.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.