Question

I have a basic JS code for a password, but whenever I type into the text box, it shows what has been typed, not the normal asterisks that are shown in password boxes. My code follows.

<!DOCTYPE html>
<html>
<title>
Enter Password
</title>
<body>
<script type="text/javascript">

var password = "THE LIST";
var x = prompt("Enter in the password "," ");
if (x == password) {
  window.location = "index.html";
}
else {
window.location = "bad.htm";
}

</script>
</body>
</html>

Note: I made this for fun, I'm not stupid enough to use it for real protection.

Était-ce utile?

La solution 2

You can't do that in a prompt. A prompt is a feature of the browser / OS that is sandboxed. If you want control you need to do it in HTML:

<input type="password" />

Autres conseils

You should use: <input type="password">.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top