Web Hosting Talk







View Full Version : javascript needs fixed


vuhndalock
01-10-2006, 12:58 PM
okay this dont work correctly

<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var password = ''
password=prompt('Please enter your password:','');
if (password != null) {
location.href="http://www.freewebs.com/s3mercenaries/clan.htm";
}
// End -->
</SCRIPT>

If i try to change the password it wont send me to the correct site
like if i did this
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var password = ''
password=prompt('Please enter your password:','');
if (password != test) {
location.href="http://www.freewebs.com/s3mercenaries/clan.htm";
}
// End -->
</SCRIPT>

it wont work can someone fix this code for me and show me where to put in the password if im just doing it wronge

Premier
01-10-2006, 04:34 PM
The 2nd version worked for me. If I input test, it gave me a 404 because http://www.freewebs.com/s3mercenaries/clan.htm doesn't exist. If I input anything else, it did nothing.

The first one needs
if (password != null) {
changed to
if (password != '') {

then any input will be redirected but with no input, nothing will happen.