w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Option ¶ÔÏó
The Option object represents a selectable option in a drop-down list in an HTML form. For each instance of an <option> tag in an HTML form, an Option object is created.
Option¶ÔÏó´ú±íHTML±íµ¥ÖеĿÉÑ¡Ïî¡£HTML±íµ¥ÖÐÖ»Òª³öÏÖ<option>±êÇ©¾ÍÓÐOption¶ÔÏó±»½¨Á¢
You can access an Option object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
Äã¿ÉÒÔ´Ó±íµ¥Êý×éµÄÊý×Ö»òÊÇÃû³ÆÀ´·ÃÎÊOption¶ÔÏ󣬻òÊÇʹÓÃgetELmentById()À´·ÃÎÊËü
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
| Property ÊôÐÔ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| defaultSelected | Sets or returns the value of the selected attribute of the option ÉèÖûòÊÇ·µ»ØOptionselectedÊôÐÔµÄÖµ |
3 | 1 | 6 | Yes |
| disabled | Sets or returns a Boolean value that specifies whether the option should be disabled ÉèÖûò·µ»ØÒ»¸ö²¼¶úÖµÅжÏOptionÊÇ·ñ½ûÓà |
5 | 1 | 6 | Yes |
| form | Returns a reference to the form that contains the option ·µ»Ø°üº¬Option±íµ¥µÄ²Î¿¼ |
3 | 1 | 6 | Yes |
| id | Sets or returns the id of the option (In IE 4 this property is read-only) ÉèÖûò·µ»ØOptionµÄid(ÔÚIE4ÖÐÕâ¸öÊôÐÔΪֻ¶Á) |
4 | 1 | No | |
| index | Sets or returns the position of the option in the select box ÉèÖûò·µ»ØOptionÔÚselect¿òÖеÄλÖà |
3 | Yes | ||
| label | Sets or returns a label for the option object ÉèÖûò·µ»ØOption¶ÔÏóµÄlabel |
6 | Yes | ||
| selected | Sets or returns the current state of the option ÉèÖûò·µ»ØOptionµÄµ±Ç°×´Ì¬£¨ÊÇ·ñΪѡÖУ© |
3 | 1 | 6 | Yes |
| text | Sets or returns the text value for the <option> tag ÉèÖûò·µ»ØOption±êÇ©µÄÎÄ×ÖÖµ |
3 | 1 | 6 | Yes |
| value | Sets or returns the value to be returned to the server when an option is selected and the form is submitted ÉèÖûò·µ»Øµ±±»Ñ¡ÖеÄOptionÌá½»µ½·þÎñÆ÷ʱËüËù°üº¬µÄÖµ |
3 | 1 | 6 | Yes |
| Method ·½·¨ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| click() | Simulates a mouse-click on the option Ä£·ÂÊó±êµã»÷Option |
4 | No |
ÆÀÂÛ (0)
All