HTML and CSS Reference
In-Depth Information
EXAMPLE
11.15 (
CONTINUED
)
<p>
Talk about yourself here:<br />
3
<textarea name="comments"
align="left"
rows="5" cols="50">I was born...
</textarea>
<p>
<b>Choose a work place:</b><br />
4
<input type="checkbox"
name="place"
value="LA" />Los Angeles
<br />
<input type="checkbox"
name="place"
value="SJ" />San Jose
<br />
<input type="checkbox"
name="place"
value="SF"
checked />San Francisco
<p></fieldset>
</form>
<p>
5
<a href="#" onClick="JavaScript: myForm.submit();"
/>
Click here to submit this form</a>
<p>
6
<a href="#" onClick="JavaScript: myForm.reset();"
/>
Click here to reset this form</a>
</body>
</html>
EXPLANATION
1
The form called
myForm
starts here. When the form is submitted, it will go to the
address assigned to the
action
attribute, and the method—how the form is sent—
is the
post
method.
2
The text field input type will accept a line of text from the user.
3
The text area box will accept up to 5 rows of text from the user.
4
The user can select any of the checkboxes. The default,
San Francisco
, is checked.
5
The link has been deactivated with the #. When the user clicks the link, the
on-
Click
event will be triggered and cause the JavaScript
submit()
method to be in-
voked (see Figure 11.23). The form data will be sent to the URL assigned to the
action
attribute of the form. The URL is a CGI program residing on the local serv-
er. Note that there is no need for the submit button here.
6
The link has been deactivated with the #. When the user clicks the link, the
on-
Click
event will be triggered and cause the JavaScript
reset()
method to be in-
voked. The input boxes will all be cleared and set back to their default values.