<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>
|