Demonstrates password field and hiden field : Password « Form Control « JavaScript DHTML






Demonstrates password field and hiden field

  

<html>
<head>
<title>Password</title>
<script>
function checkPass(){
  var guess = document.myForm.pwdField.value;
  var secret = document.myForm.hiddenField.value;
  if (guess == secret){
    document.myForm.txtOutput.value = "correct";
  } else {
    document.myForm.txtOutput.value = "incorrect.";
  }
}</script>
</head>
<body>
<form name = myForm>
Please enter password</td>
<input type = "password" name = pwdField>
<input type = "button" value = "click me" onClick = "checkPass()">
<textArea name = "txtOutput" rows = 1 cols = 35></textarea>
<input type = "hidden" name = "hiddenField" value = "JavaScript">
</form>
</body>
</html>

   
    
  








Related examples in the same category

1.Password field size
2.Get text input max Length
3.Password Protecting a Page
4.Methods and Properties of the Password Object