Compare value in the password fields : Password « Form « JavaScript Tutorial






<head>
<title>Password</title>
<script>
function checkPass(){
  var guess = document.myForm.pwdGuess.value;
  var secret = document.myForm.hdnSecret.value;
  if (guess == secret){
    document.myForm.txtOutput.value = "You may proceed.";
  } else {
    document.myForm.txtOutput.value = "That is incorrect.";
  }
}
</script>
</head>
<body>
<center>
<h1>Password<hr></h1>
<form name = "myForm">
<table>
<tr>
  <td>Please enter password</td>
  <td><input type = "password"
             name = "pwdGuess">
</tr>

<tr>
  <td colspan = 2><center>
    <input type = "button"
           value = "click me"
           onClick = "checkPass()"></center>
  </td>
</tr>

<tr>
  <td colspan = 2>
    <center>
    <textArea name = "txtOutput"
              rows = 1
              cols = 35>
    </textarea>
    </center>
  </td>
</tr>
</table>
<input type = "hidden"
       name = "hdnSecret"
       value = "JavaScript">
</form>
<hr>

</center>
</body>








10.10.Password
10.10.1.Password
10.10.2.Password.blur()
10.10.3.Password.defaultValue
10.10.4.Password.focus()
10.10.5.Password.form
10.10.6.Password.handleEvent()
10.10.7.Password.name
10.10.8.Password.onBlur
10.10.9.Password.onFocus
10.10.10.Password.select()
10.10.11.Password.type
10.10.12.Password.value
10.10.13.Compare value in the password fields