Availability
DOM Level 1 HTML
Inherits from/Overrides
Node
Properties
boolean disabled
If
true, the <select>
element is disabled and the user may not interact with it. Mirrors
the disabled attribute.
readonly HTMLFormElement form
The
<form> element that contains this one.
readonly long length
The number
of <option> elements contained by this
<select> element. Same as
options.length.
boolean multiple
If
true, the <select>
element allows multiple options to be selected. Otherwise, the
selections are mutually exclusive and only one may be selected at a
time. Mirrors the multiple attribute.
String name
The name of
this form element. Mirrors the name attribute.
readonly HTMLCollection options
An array
(HTMLCollection) of HTMLOptionElement objects that represent the
<option> elements contained in this
<select> element, in the order in which they
appear.
long selectedIndex
The
position of the selected option in the options
array. If no options are selected, this property is -1. If multiple
options are selected, this property returns the index of the first
selected option.
long size
The number of
options to display at once. If this property is 1, the
<select> element will typically be displayed
using a drop-down menu or list. If it is greater than 1, the
<select> is typically displayed using a
fixed-size list control, with a scrollbar if necessary. Mirrors the
size attribute.
long tabIndex
The
position of this element in the tabbing order. Mirrors the
tabindex attribute.
readonly String type
If
multiple is true, this property
is "select-multiple". Otherwise, it is
"select-one".
Methods
add( )
Inserts a new HTMLOptionElement into the options
array, either by appending it at the end of the array or by inserting
it before another specified option.
blur( )
Takes keyboard focus away. focus( )
Transfers keyboard focus to this element. remove( )
Removes the <option> element at the
specified position.
Description
This interface represents a <select> element
in an HTML form. The options property provides
convenient access to the set of <option>
elements it contains, and the add( ) and
remove( ) methods provide an easy way to modify
the set of options.
See Also
HTMLFormElement, HTMLOptionElement; Option and Select objects in the
client-side reference section; Chapter 15
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.