HTML and CSS Reference
In-Depth Information
Table 11.12 Methods of the password Object
Method
What It Describes
blur()
Removes focus from the password box.
focus()
Puts focus on the password box.
handleEvent()
Invokes the handler for a specified event (JavaScript 1.2).
select()
Selects or highlights text in the box.
unwatch()
Turns off the watch for a particular property.
watch()
Watches, and when a property is changed, calls a function.
EXAMPLE 11.19
1 <html>
<head><title>Password Boxes</title>
<script type="text/javascript">
2
function verify(pw){
if ( pw.value == "letmein" ){
alert("The chamber door will open now!");
}
3
else{
alert("Sorry, you cannot enter. Please leave.");
}
}
</script>
</head>
<body bgcolor="#330033"><font color="FFCCFF">
<div align="center">
<h2> Welcome To The Secret Chamber</h2>
<img src="wizard.jpg"><br />
To enter, a password is required:<br />
4
<form name="form1" id="form1">
5
<input type="password"
name="passwfield"
size="30"
6
onBlur="return verify(this)" />
7
<input type=button value="Knock to verify" />
</form>
</div>
</body>
</html>
 
Search WWH ::




Custom Search