Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-28-2006, 07:19 PM   PM User | #1
florida
Regular Coder

 
Join Date: Jul 2002
Posts: 362
Thanks: 0
Thanked 0 Times in 0 Posts
florida is an unknown quantity at this point
Password mask

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:
Code:
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>");
}
florida is offline   Reply With Quote
Old 12-28-2006, 08:15 PM   PM User | #2
joh6nn
wei wu wei


 
joh6nn's Avatar
 
Join Date: Jun 2002
Location: 72° W. 48' 57" , 41° N. 32' 04"
Posts: 1,887
Thanks: 0
Thanked 1 Time in 1 Post
joh6nn is an unknown quantity at this point
http://www.codingforums.com/showthread.php?t=10114
__________________
bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

i am a loser geek, crazy with an evil streak,
yes i do believe there is a violent thing inside of me.
joh6nn is offline   Reply With Quote
Old 12-28-2006, 08:16 PM   PM User | #3
Pyth007
Regular Coder

 
Join Date: Sep 2005
Posts: 535
Thanks: 0
Thanked 0 Times in 0 Posts
Pyth007 is an unknown quantity at this point
Is there a reason why you want to use strictly JS?
How about HTML:
Code:
<intput type='password' onchange='validate(this.value)' />
__________________
If you want answers, write a smart question.

Yes, someone probably does know how...

Oh, and if you want to learn, STFW!
Pyth007 is offline   Reply With Quote
Old 12-28-2006, 08:18 PM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,447
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:21 AM.


Advertisement
Log in to turn off these ads.