سؤال

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.

هل كانت مفيدة؟

المحلول 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" />

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top