Home >Web Front-end >HTML Tutorial >HTML tag to create single or multiple selection menus

WBOY
WBOYOriginal
2016-08-29 08:36:502722browse

All major browsers support the tag appears, a Select object is created.

You can access a Select object by looping through the form's elements[] array, or using document.getElementById().

Select object collection

Collection Description
options[] Returns an array containing all options in the dropdown list.

Select object properties

Property Description
disabled Sets or returns whether the dropdown should be disabled.
form Returns a reference to the form containing the dropdown list.
id Set or return the id of the drop-down list.
length Returns the number of options in the drop-down list.
multiple Set or return whether to select multiple items.
name Set or return the name of the drop-down list.
selectedIndex Set or return the index number of the selected item in the drop-down list.
size Set or return the number of visible rows in the dropdown list.
tabIndex Set or return the tab key control order of the drop-down list.
type Returns the form type of the drop-down list.

Standard properties

Property Description
className Sets or returns the class attribute of an element.
dir Set or return the direction of text.
lang Set or return the language code of the element.
title Sets or returns the element's title attribute.

Select object method

Method Description
add() Add an option to the dropdown list.
blur() Remove focus from dropdown list.
focus() Set focus on dropdown list.
remove() Remove an option from the dropdown list.

Select object event handle

Event handle Description
onchange Event handler called when the selection is changed.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:HTML
tag creates a horizontal line in the page
Next article:HTML
tag creates a horizontal line in the page

Related articles

See more