ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Select ¶ÔÏó

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM
DOM Input Checkb..
DOM Input File ¶..
DOM Input Hidden..
DOM Input Passwo..
DOM Input Radio ..
DOM Input Reset ..
DOM Input Submit..
DOM Input Text ¶..
DOM Link ¶ÔÏó
DOM Location ¶ÔÏ..
DOM Meta ¶ÔÏó
DOM Navigator ¶Ô..
DOM ¶ÔÏó
DOM Option ¶ÔÏó
DOM Screen ¶ÔÏó
DOM Select ¶ÔÏó
DOM Style ¶ÔÏó
DOM Table ¶ÔÏó
DOM TableData ¶Ô..
DOM TableHeader ..

DOM Select ¶ÔÏó


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:6870 :: ::

Select ¶ÔÏó

The Select object represents a drop-down list in an HTML form. For each instance of an HTML <select> tag in a form, a Select object is created.
Select¶ÔÏó´ú±íHTML±íµ¥ÖеÄÏÂÀ­ÁÐ±í¡£Ã¿µ±±íµ¥ÖгöÏÖ<select>±êÇ©¾ÍÓÐSelect¶ÔÏó±»½¨Á¢ÆðÀ´

You can access a Select object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
Äã¿ÉÒÔ´Ó±íµ¥Êý×éµÄÊý×Ö»òÊÇÃû³ÆÀ´·ÃÎÊSelect¶ÔÏ󣬻òÊÇʹÓÃgetELmentById()À´·ÃÎÊËü

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Select ¶ÔÏ󼯺Ï

Collection
¼¯ºÏ
Description
ÃèÊö
IE  F N W3C
options[] Returns an array of all the options in a dropdown list
·µ»ØÔÚÏÂÀ­ÁбíÖÐËùÓпÉÑ¡ÏîµÄÊý×é
3 1 2 Yes

Select ¶ÔÏóÊôÐÔ

Property
ÊôÐÔ
Description
ÃèÊö
IE  F N W3C
accessKey Sets or returns the keyboard key to access the dropdown list
ÉèÖûò»ñÈ¡ÏÂÀ­Áбí(select)¶ÔÏóµÄ¿ì½Ý¼ü¡£
4     No
align Sets or returns the alignment of the dropdown list according to the surrounding text
ÉèÖûò·µ»ØÏà¶ÔÖÜΧÎÄ×ÖÏÂÀ­ÁбíµÄ¶ÔÆë·½Ê½
4     No
disabled Sets or returns whether or not the dropdown list should be disabled
ÉèÖûò·µ»ØÏÂÀ­ÁбíÊÇ·ñΪ½ûÓÃ
5 1 6 Yes
form Returns a reference to the dropdown list's parent form
ÉèÖûò·µ»ØÏÂÀ­ÁбíµÄ¸¸±í
3 1 2 Yes
id Sets or returns the id of the dropdown list (In IE 4 this property is read-only)
ÉèÖûò·µ»ØÏÂÀ­ÁбíµÄidÖµ(ÔÚIE4Ö»Õâ¸öÊôÐÔΪֻ¶ÁÊôÐÔ)
4 1   No
length Sets or returns the number of options in the dropdown list
ÉèÖûò·µ»ØÔÚÏÂÀ­ÁбíÖпÉÑ¡ÏîÄ¿µÄÊýÁ¿
3 1 2 Yes
multiple Sets or returns a Boolean value that indicates whether or not multiple items can be selected
ÉèÖûò»ñÈ¡±íÃ÷ÁбíÖÐÊÇ·ñ¿ÉÑ¡Öжà¸öÏîÄ¿µÄ Boolean Öµ¡£
3 1 6 Yes
name Sets or returns the name of the dropdown list
ÉèÖûò»ñÈ¡¶ÔÏóµÄÃû³Æ¡£
3 1 2 Yes
selectedIndex Sets or returns the index of the selected option in the dropdown list
ÉèÖûò»ñȡѡÖÐÑ¡ÏîλÓÚ select ¶ÔÏóÖеÄλÖá£
3 1 2 Yes
size Sets or returns the number of rows in the dropdown list
ÉèÖûò»ñÈ¡ÁбíÖеÄÐÐÊý¡£
3 1 6 Yes
tabIndex Sets or returns the tab order for the dropdown list
ÉèÖûò»ñÈ¡¶¨Òå¶ÔÏóµÄ Tab ˳ÐòµÄË÷Òý¡£
5     Yes
type Returns the type of the form element. For a dropdown list it will be "select-one" or "select-multiple"
¸ù¾Ý MULTIPLE ÊôÐÔµÄÖµ»ñÈ¡ select ¿Ø¼þµÄÀàÐÍ¡£
4 1 3 Yes
value Sets or returns the value to be returned to the server when the form is submitted
ÉèÖûò»ñÈ¡µ±±íµ¥¿Ø¼þÌύʱ·µ»Ø¸ø·þÎñÆ÷µÄÖµ¡£
3 1 6 Yes

Select ¶ÔÏó·½·¨

Method
·½·¨
Description
ÃèÊö
IE F N W3C
add() Adds an option to the dropdown list
Ïò ÏÂÀ­ÁбíÖÐÌí¼ÓÒ»¸öÑ¡Ïî¡£
4     Yes
blur() Removes focus from the dropdown list
´ÓÏÂÀ­ÁбíÖÐÒÆ³ý½¹µã
4 1 3 Yes
focus() Sets focus on the dropdown list
ΪÏÂÀ­ÁбíÉèÖý¹µã
4 1 3 Yes
remove() Removes an option from the dropdown list
´ÓÏÂÀ­ÁбíÖÐɾ³ý¿ÉÑ¡Ïî
4 1 6 Yes

Select ¶ÔÏóʼþ

Syntax: object.event_name="someJavaScriptCode"
Óï·¨£º¶ÔÏó.ʼþÃû³Æ="һЩJS´úÂë"

Event
ʼþ
Description
ÃèÊö
IE F N W3C
onBlur Executes some code when the dropdown list loses focus
µ±ÏÂÀ­Áбíʧȥ½¹µãµÄʱºòÖ´ÐÐһЩ´úÂë
3 1 2  
onChange Executes some code when the dropdown list loses focus and its value has altered
µ±ÏÂÀ­Áбíʧȥ½¹µã²¢ÇÒËüµÄÖµ·¢Éú±ä»¯µÄʱºòÖ´ÐÐһЩ´úÂë
3 1 2  
onClick Executes some code when the user clicks the left mouse button in the dropdown list
µ±Óû§µã»÷ÁËÏÂÀ­ÁбíÖ´ÐÐһЩ´úÂë
4      
onFocus Executes some code when the dropdown list gets focus
µ±ÏÂÀ­ÁбíµÃµ½½¹µãÖ´ÐÐһЩ´úÂë
4 1 2  

ÆÀÂÛ (0) All