2 * Copyright (c) 2003 World Wide Web Consortium,
3 * (Massachusetts Institute of Technology, Institut National de
4 * Recherche en Informatique et en Automatique, Keio University). All
5 * Rights Reserved. This program is distributed under the W3C's Software
6 * Intellectual Property License. This program is distributed in the
7 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
13 package org.w3c.dom.html2;
15 import org.w3c.dom.DOMException;
18 * The select element allows the selection of an option. The contained options
19 * can be directly accessed through the select element as a collection. See
20 * the SELECT element definition in HTML 4.01.
21 * <p>See also the <a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>Document Object Model (DOM) Level 2 HTML Specification</a>.
23 public interface HTMLSelectElement extends HTMLElement {
25 * The type of this form control. This is the string "select-multiple"
26 * when the multiple attribute is <code>true</code> and the string
27 * "select-one" when <code>false</code>.
29 public String getType();
32 * The ordinal index of the selected option, starting from 0. The value -1
33 * is returned if no element is selected. If multiple options are
34 * selected, the index of the first selected option is returned.
36 public int getSelectedIndex();
38 * The ordinal index of the selected option, starting from 0. The value -1
39 * is returned if no element is selected. If multiple options are
40 * selected, the index of the first selected option is returned.
42 public void setSelectedIndex(int selectedIndex);
45 * The current form control value (i.e. the value of the currently
46 * selected option), if multiple options are selected this is the value
47 * of the first selected option.
49 public String getValue();
51 * The current form control value (i.e. the value of the currently
52 * selected option), if multiple options are selected this is the value
53 * of the first selected option.
55 public void setValue(String value);
58 * The number of options in this <code>SELECT</code>.
59 * @version DOM Level 2
61 public int getLength();
63 * The number of options in this <code>SELECT</code>.
64 * @exception DOMException
65 * NOT_SUPPORTED_ERR: if setting the length is not allowed by the
67 * @version DOM Level 2
69 public void setLength(int length)
73 * Returns the <code>FORM</code> element containing this control. Returns
74 * <code>null</code> if this control is not within the context of a
77 public HTMLFormElement getForm();
80 * The collection of <code>OPTION</code> elements contained by this
82 * @version DOM Level 2
84 public HTMLOptionsCollection getOptions();
87 * The control is unavailable in this context. See the disabled attribute
88 * definition in HTML 4.01.
90 public boolean getDisabled();
92 * The control is unavailable in this context. See the disabled attribute
93 * definition in HTML 4.01.
95 public void setDisabled(boolean disabled);
98 * If true, multiple <code>OPTION</code> elements may be selected in this
99 * <code>SELECT</code>. See the multiple attribute definition in HTML
102 public boolean getMultiple();
104 * If true, multiple <code>OPTION</code> elements may be selected in this
105 * <code>SELECT</code>. See the multiple attribute definition in HTML
108 public void setMultiple(boolean multiple);
111 * Form control or object name when submitted with a form. See the name
112 * attribute definition in HTML 4.01.
114 public String getName();
116 * Form control or object name when submitted with a form. See the name
117 * attribute definition in HTML 4.01.
119 public void setName(String name);
122 * Number of visible rows. See the size attribute definition in HTML 4.01.
124 public int getSize();
126 * Number of visible rows. See the size attribute definition in HTML 4.01.
128 public void setSize(int size);
131 * Index that represents the element's position in the tabbing order. See
132 * the tabindex attribute definition in HTML 4.01.
134 public int getTabIndex();
136 * Index that represents the element's position in the tabbing order. See
137 * the tabindex attribute definition in HTML 4.01.
139 public void setTabIndex(int tabIndex);
142 * Add a new element to the collection of <code>OPTION</code> elements for
143 * this <code>SELECT</code>. This method is the equivalent of the
144 * <code>appendChild</code> method of the <code>Node</code> interface if
145 * the <code>before</code> parameter is <code>null</code>. It is
146 * equivalent to the <code>insertBefore</code> method on the parent of
147 * <code>before</code> in all other cases. This method may have no
148 * effect if the new element is not an <code>OPTION</code> or an
149 * <code>OPTGROUP</code>.
150 * @param element The element to add.
151 * @param before The element to insert before, or <code>null</code> for
152 * the tail of the list.
153 * @exception DOMException
154 * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
155 * the <code>SELECT</code> element.
157 public void add(HTMLElement element,
162 * Remove an element from the collection of <code>OPTION</code> elements
163 * for this <code>SELECT</code>. Does nothing if no element has the
165 * @param index The index of the item to remove, starting from 0.
167 public void remove(int index);
170 * Removes keyboard focus from this element.
175 * Gives keyboard focus to this element.