HTML and CSS Reference
In-Depth Information
EXAMPLE 11.12 ( CONTINUED )
<body>
5
<form action="http://cgi-bin/testform.cgi"
method="post"
onReset="return resetAll();" />
Enter your user id:
6
<input type="text"
name="textbox"
value="Name? "
id="textbox" />
value="Name? " />
<p>Type your password:
7
<input type="password"
name="secret"
id="secret" />
</p><p>
<input type="submit"/>
8
<input type="reset"
value="Reset Form"/>
</p>
</form>
</body>
</html>
EXPLANATION
1
The function called resetAll() is defined. It is invoked when the onReset event han-
dler is triggered.
2
If the user clicks the Reset button on line 8, he or she sees this confirm dialog box,
a true value will be returned by this function, allowing the reset to clear all the
input fields and set them back to their original values.
3
If a value true is returned, the fields will be cleared.
4
If a value of false is returned by this function, the reset action will be dismissed.
5
The form starts here. The onReset event handler is an attribute of the <form> tag.
6, 7
The input types for this form are a text field and a password field.
8
The reset button is used to reset the form fields back to their original values.
When this button is clicked, the onReset event handler will be triggered. See
Figure 11.21.
Search WWH ::




Custom Search