home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


TEXTAREA provides a mechanism for the user to input a block of text. Usually this is done by providing a text input window. The text input by the user can grow to almost unlimited size, and is not limited, either horizontally or vertically, by the size of the displayed input window. Scrollbars are often presented if the text entered into a TEXTAREA grows to be (or initially is) bigger than the displayed region.


Figure 6.23 HTML example document illustrating FORM INPUT, SELECT, and TEXTBOX input elements. Figure 6.24 shows this document as displayed by the Netscape Navigator 3 browser.

<HTML><HEAD><TITLE> HTML FORM Example (2)</TITLE></HEAD>
<BODY>

<H2>HTML FORM Example (2) </H2>
<P>Submit your abstract for registration in the appropriate databases.
<FORM  ACTION=“http://side.edu/cgi-bin/submit_abstract”>
<B>1. Please give Name and Password </B>
<BLOCKQUOTE>
  <B>Name:</B>     <INPUT TYPE=“text”     NAME=“userid” VALUE=“guest” SIZE=20>
  <B>Password:</B> <INPUT TYPE=“password” NAME=“password” VALUE=“bozo...” SIZE=8>
</BLOCKQUOTE>
<B>2. Select Appropriate Database(s)</B> <BR>
<BLOCKQUOTE>
   <B>Physics: </B>
    <SELECT NAME=“physics_database” MULTIPLE SIZE=3>
       <OPTION SELECTED> Condensed-Matter
       <OPTION> High Energy
       <OPTION> Solid-State
       <OPTION> Quantum Cosmology
       <OPTION> Astrophysics
   </SELECT>
   <B>Chemistry: </B>
   <SELECT NAME=“chemistry_database” MULTIPLE SIZE=3>
      <OPTION> Surface Dynamics
      <OPTION> Quantum Chemistry
      <OPTION SELECTED> Polymer Dynamics
      <OPTION> Biochemistry
      <OPTION> Nuclear Chemistry
   </SELECT>
</BLOCKQUOTE>
<B>3. Enter Abstract: </B>
<BLOCKQUOTE>
   <TEXTAREA NAME=“abstract” COLS=50 ROWS=4>
If you are submitting an abstract, select the
desired databases from the above list, delete
this text, type (or paste) the abstract into
this box and press the “Deposit Abstract” button.
   </TEXTAREA>
</BLOCKQUOTE>
<B>4. Submit Form or Reset --</B>
<INPUT TYPE=“submit” NAME=“depo” VALUE=“Deposit Abstract”>
<INPUT TYPE=reset VALUE=“Reset Form”>
</FORM>
<HR>
<ADDRESS>  Form by <A HREF=“about_the_author.html”> I.S.G</A> </ADDRESS>
</BODY></HTML>


Figure 6.24  Display of the document shown in Figure 6.23 by the Netscape Navigator 3 browser.

The size of a TEXTAREA is set by the COLS and ROWS attributes (the default size in the absence of these attributes is browser-specific). Since TEXTAREA windows usually display characters using a fixed-width font, COLS specifies the input box width as a number of characters, while ROWS specifies the height as the number of displayable text rows. TEXTAREA input can include any printable characters: The TEXTAREA data are simply characters to be sent elsewhere. Thus a person typing text into a TEXTAREA can in principle send an entire HTML document to a server by typing (or cutting and pasting) the document into the TEXTAREA.

By default, text in a TEXTAREA does not wrap—lines can be as long as desired, with line wrapping only occurring at carriage returns explicitly typed in by the user. In some cases, it is more convenient if the TEXTAREA element itself automatically wraps the text, either virtually (the lines are displayed with wrapping, but the software-imposed new-line characters are not sent as part of the TEXTAREA data) or physically (the new-line characters introduced by the TEXTAREA formatting are sent as part of the TEXTAREA data). Netscape Navigator supports a special WRAP attribute that allows for these options.

The attributes are:

COLS=“number” (mandatory) Specifies the display width of a TEXTAREA, in columns.
DISABLED (optional; Internet Explorer 4 only) Disables user-control of the TEXTAREA content. Also, the user cannot use the tab key to select this element. Furthermore, the data content of the element is not sent when the form is submitted to a server. Please see Chapter 7 for a detailed description of DISABLED.
NAME=“string” (mandatory) Specifies the variable name associated with TEXTAREA contents.
READONLY (optional; Internet Explorer 4 only) As with DISABLED, this attribute disables user-control of the TEXTAREA content. However, in this case, the user can select the element using tab key, and the element content is included when the form is submitted to a server. Please see Chapter 7 for a detailed description of READONLY.
ROWS=“number” (mandatory) Specifies the display height of a TEXTAREA, in rows.
WRAP=“off,” “soft,” “hard” (optional) Specifies the handling of word-wrapping within the TEXTAREA element. WRAP=“off” disables word-wrapping completely—the only new-line characters are those explicitly typed or included with the input data. WRAP=“soft” causes virtual word-wrapping—new-line characters are introduced to ensure that the text fits within the specified area, but these characters are not included with the data when the FORM is submitted. According to the Netscape specifications, WRAP=“hard” should cause word-wrapping equivalent to WRAP=“soft,” but in this case the extra new-line characters should be included with the data when the FORM is submitted. The default behavior is WRAP=“off.”

Text placed inside a TEXTAREA element is displayed as an initial value: A browser provides some way to edit the displayed text. Note that HTML markup tags are not interpreted inside a TEXTAREA, and are displayed as plain text. However, entity and character references inside a TEXTAREA element are interpreted and are converted to their respective characters prior to being displayed.

Figures 6.23 and 6.24 show a typical example of a TEXTAREA element.

Lists and List-Related Elements

There are two broad categories of list elements. Description lists (DL) define glossary-like lists, and can only contain two elements: DT (description term) and DD (the description). Regular lists define numbered or bulleted items. There are four regular list elements—DIR, MENU, OL, and UL. These elements can contain one thing: LI elements, which define the items within the list.


NOTE: Avoid DIR and MENU Lists

In HTML 4, the elements DIR and MENU are marked as deprecated and are likely to be dropped in a future version of HTML. You should thus avoid DIR and MENU and use UL lists instead.


The list elements support nesting of lists: DD and LI elements can contain any of the list element types, in addition to regular block elements such as paragraphs or tables.

DL Element: Glossary List

Usage: <DL> ... </DL>
Can Contain: DT, DD
Can Be Inside: BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, LI, NOFRAMES, NOSCRIPT, TD, TH,
APPLET, BUTTON, IFRAME, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers
COMPACT

This list type, known as a definition or glossary list, is designed for a list of items each with an associated, descriptive paragraph. This can be used, for example, for traditional glossaries. A DL list can contain two elements:

  DT—The term being defined
  DD—The definition of the term

Logically, DT and DD elements should appear in pairs. However, the specification does not require this, so that you can have DT and DD elements in any order you like. In general, DT elements are rendered flush with the left margin, while DD elements are placed one line below the DT and slightly indented.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.