The option Object [3]

The option object is used to create entries in a select list by using the following syntax:

optionName = new Option(optionText, optionValue, defaultSelected, selected)

Then the following line is used:

selectName.options[index] = optionName.

Properties

  • defaultSelected— A Boolean value specifying whether the option is selected by default.

  • index— An integer value specifying the option's index in the select list.

  • prototype— Provides a mechanism to add properties to an option object.

  • selected— A Boolean value indicating whether the option is currently selected.

  • text— A string value reflecting the text displayed for the option.

  • value— A string value indicating the value submitted to the server when the form is submitted.

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.