HTML and CSS Reference
In-Depth Information
Table 11.3 Methods of the document Object (continued)
Method
What It Does
focus()
Brings the document into focus.
getElementById()
Returns a reference to the first object with the specified ID.
getElementsByName()
Returns a collection of objects with the specified name.
getElementsByTagName()
Returns a collection of objects with the specified tag name.
open()
Begins a new document, erasing the old one.
write()
Writes and appends text into the current document.
writeln()
Same as write() , but appends a newline if in a <pre> tag.
11.3 About HTML Forms
At the heart of the Web is the form. It is used to pass information from the browser to
the server. Anytime you go online and order a book, trade at an auction, fill out a survey,
or send an e-mail using a Web browser, you are working with a form.
An HTML form offers you a number of ways to accept input, such as radio buttons,
checkboxes, popup menus, hidden fields, and textboxes; these are called virtual input
devices or controls. Once the form has been filled out by a user, it normally is sent to a
server where the input is processed by a server-side program, such as a Java servlet, CGI,
ASP.NET, or PHP application. It is important to understand how the form data is col-
lected and sent to the server and then what role JavaScript has in this process.
11.3.1 Attributes of the < form >Tag
All forms are in HTML documents. They begin with a <form> tag and its attributes, fol-
lowed by the input fields where the user enters form information, and end with a
</form> tag.
<form name="form1" id="form1"
action="URL to server program"
method="post">
<input type="text" name="town" id="town" />
(continue here with body of the form
including input devices for
filling out the form;
see Table 11.4 for a complete example).
</form>
 
 
 
Search WWH ::




Custom Search