Drop Down List
-
Multiple Choice Selections
<select name="year">
<option value="Freshman">Freshman
<option value="Sophomore">Sophomore
<option value="Junior">Junior
<option value="Senior">Senior
<option value="Graduate">Graduate
<option value="Perpetual">Perpetual
<option value="Other" selected>Other
</select>
-
value - what is returned to the CGI script.
-
In <select> tag, MULTIPLE allows multiple selection.
-
select object properties:
-
name - NAME in the SELECT tag.
-
length - number of options
-
options - array of <OPTION> elements.
-
selectedIndex - index of currently selected item.
-
option array properties:
-
index - array element number
-
defaultSelected - SELECTED attribute.
-
selected - current state of the option. Read/write attribute.
-
name - value of NAME attribute in the OPTION
tag.
-
text - the text in the option. Read/write in some cases.
-
Methods:
-
focus() - sets focus
-
blur() - lose focus
-
Event Handlers:
-
onFocus - focus gained.
-
onChange - item selected.
-
These can change dynamically, which can prevent expensive calls to a server!
-
To read data, first find the index, then select the corresponding array
element.
Example:
Class Registration
E-mail
Home
Internet II: Day 4