...

View Full Version : Password mask



florida
12-28-2006, 07:19 PM
I have a password protected page but want to mask the output when entered. Now it prompts for password but shows the input.

Please advise how I can do this:


var password = prompt("Enter your password","");
if (password == "hotsource") {
alert("Password accepted! Loading page...");

document.write("<p>data here.</p>");

}

else {
alert("" +password+ " is an Invalid Password! Access denied...");

document.write("<p><b>You have entered an invalid password. ");
document.write("Access to the document is denied.</b></p>");
}

joh6nn
12-28-2006, 08:15 PM
http://www.codingforums.com/showthread.php?t=10114

Pyth007
12-28-2006, 08:16 PM
Is there a reason why you want to use strictly JS?
How about HTML:


<intput type='password' onchange='validate(this.value)' />

felgall
12-28-2006, 08:18 PM
You will have to make your own equivalent to the prompt box that uses a password field. There isn't one built into Javascript. See http://javascript.about.com/library/blmodald1.htm for an example of one way to do it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum