문제

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