show password in html code example

Example 1: how to make a password system in html

<script type="text/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");
 window.location = "good.htm";
}
else {
 window.location = "bad.htm";
}
</script>

Example 2: how to make a show password button

function myFunction() {
  var x = document.getElementById("*passwordbox-id*");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}

Example 3: html show password

//Javascript show all password textboxes script by me
var k = document.getElementsByTagName('input')
for(i=0;i<k.length;i++){
    if(k[i].type = "password"){
        k[i].type = "text"
    }
}

Tags: