Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
410
Chapter 16 Using HTML Forms
ONCLICK, ONFOCUS, ONBLUR, and ONCHANGE
These nonstandard attributes are supported by browsers that under
stand JavaScript. They indicate code to be executed when the entry is
clicked on, gains the input focus, loses the input focus, and loses the
focus after having been changed, respectively.
HTML Element:
Attributes:
SELECTED
,
VALUE
Only valid inside a
SELECT
element, this element specifies the menu choices.
VALUE
VALUE
gives the value to be transmitted with the
NAME
of the
SELECT
menu if the current option is selected. This is not the text that is dis
played to the user; that is specified by separate text listed after the
OPTION
tag.
SELECTED
If present,
SELECTED
specifies that the particular menu item shown is
selected when the page is first loaded.
The following example creates a menu of programming language choices.
Because only a single selection is allowed and no visible
SIZE
is specified, it is
displayed as a combo box. Figures 16 16 and 16 17 show the initial appear
ance and the appearance after the user activates the menu by clicking on it. If
the entry
Java
is active when the form is submitted, then
language=java
is
sent to the server side program. Notice that it is the
VALUE
attribute, not the
descriptive text, that is transmitted.
Favorite language:
Figure 16 16 A SELECT element displayed as a combo box (drop down menu).
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved