General discussion

Locked

Hide/mask JavaScript password

By kent2612 ·
how do i hide the password
when it is input via the prompt dialogue. So as not to allow others around
to see the password.

<script language="Javascript">

<!--

var password = "please"

var x = prompt("Enter in the password"," ")

if (x.toLowerCase() == password) {
alert("Come right in \n \n You've entered in the right password")
location = "right.html"
}

else {
location = "wrong.html"
}

//-->
</script>

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by nikki96 In reply to Hide/mask JavaScript pass ...

You don't. Anyone can look at client side text. You can obfuscate it, but anyone can just deobfuscate it.
Javascript is not for passwords. Use .htaccess or some other server-side method of verification.

Collapse -

by CptOmlly In reply to Hide/mask JavaScript pass ...

How about using the html form input type password?
Here's an example.

<P><LABEL ACCESSKEY=P>Password: <INPUT TYPE=password NAME=pw SIZE=12 MAXLENGTH=12></LABEL></P>

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums