Share via


SELECT XHTML Element

Send Feedback

The SELECT element denotes a list box or drop-down list. This is an inline element and requires a closing tag.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties for All DOM Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events, methods and collections.

Attributes

Attribute Value PPC SP Description
ACCESSKEY 0...9, #, * Yes Yes Gives access or focus to an active HTML element by using a keyboard character.
Note   For Pocket PCs, supported only for devices running Windows Mobile 2003 software or later.
CLASS   Yes Yes Associates the element with a CSS style.
Note   Supported only for devices running Windows Mobile 2003 software or later.
DISABLED   Yes Yes Disables the element so that it appears dimmed and does not respond to user input.
Note   Supported only for devices running Windows Mobile 2003 software or later.
ID   Yes Yes Uniquely identifies the element within a document.
Note   Supported only for devices running Windows Mobile 2003 software or later.
MULTIPLE   Yes Yes Specifies that multiple items that can be selected.
NAME String Yes Yes Specifies a name for the select control, which is submitted (a name or value pair for each selected OPTION element) so that script can reference the control.
ONBLUR   Yes Yes Event that occurs when the select control loses focus by the pointing device or by tabbing navigation.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
ONCHANGE   Yes Yes Event that occurs when the select control loses the input focus and its value has been modified since gaining focus.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
ONFOCUS   Yes Yes Event that occurs when the select control receives focus by a pointing device or by tabbing navigation.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
SIZE 0...# Yes Yes Specifies the select control size. When the default value 1 is used, a combo box is rendered. For values greater than 1, a list box is rendered
STYLE   Yes Yes Provides the definition of the CSS styles used for this element.
Note   Supported only for devices running Windows Mobile 2003 software or later.
TABINDEX   Yes Yes Sets the order in which elements are tabbed to.
Note   Supported only for devices running Windows Mobile 2003 software or later.

Scripting Properties

Property Type Access Comments
accessKey string Read/Write  
disabled boolean Read/Write  
form object Read Only  
length long Read Only  
multiple boolean Read Only  
name string Read Only  
selectedIndex long Read/Write Sets or retrieves the index of the selected option in a SELECT object. This index is 0 based and returns -1 if no items are selected. Setting the selectedIndex clears any existing selected items. This property is not very useful for SELECT w/the MULTIPLE attribute, as it only returns the index of the first selected option.
size long Read Only  
type string Read Only Always returns:
  • select-one for SELECT controls without the MULTIPLE attribute
  • select-multiple for SELECT controls with the MULTIPLE attribute
value string Read/Write  

Scripting Events

Event Supported Comment
onchange Yes Fires when the user changes the selection in the SELECT control. It does not fire when the selection is changed programmatically.
onblur Yes  
onfocus Yes  

Scripting Methods

Method Arguments Support Comments
add Option Yes Adds an option element
focus   Yes Syntax:

select.focus()

  • This method sets the focus to the SELECT control.
item ([optional] variant name,
[optional] variant index)
Yes  
remove Option Yes Removes an option element

Scripting Collections

Collections Arguments Support Comments
options   Yes Retrieves a collection of OPTION objects in a SELECT object.

Syntax:

[colOptions=]select.options

[oObject=]select.options(vIndex)

colOptions:

  • Collection of options

oObject:

  • Reference to an individual item in the array of elements contained by the object.

vIndex:

  • Required. Integer that specifies the element to retrieve. The value of vIndex cannot be accessed as a string.
   length long Read Only Retrieves the number of options in the collection.
   item ([optional] variant name,
[optional] variant index)
Yes  

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later

See Also

XHTML Elements

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.