Click to See Complete Forum and Search --> : Help password Js


naturalmedia
10-22-2003, 03:25 AM
Hi guy are you doing?
we have just a little problem, now will be show you .
i find a protection password js but i try to modify and doesn't Work ,
the only problem is if you lave the password camp blank you go in the protected page.
Someone now how i can stop user or ask again the password ??
this is the js to edit :



<script language="JavaScript">

function passWord() {

var testV = 1;

var pass1 = prompt('Inserisci la Password');

while (testV < 3) {

if (!pass1) history.go(index.htm)

if (pass1.toLowerCase() == "luca") {

alert('La tua password è esatta');

break;

}

testV+=1;

var pass1 = prompt('Sbagliato! Puoi riprovare.','Password');

}

if (pass1.toLowerCase()!="altro" & testV ==2) history.go(dvd/nx.htm);

return " ";

}

document.write(passWord());

</script>

Khalid Ali
10-22-2003, 07:08 AM
To make sure that user does enter a value in the password field you wil need to compare the password string witht the empty value,something like this

if(pass1!=""){//password is not empty

}else{//password is empty
//show password field here again
}