001: /*
002: * Copyright (c) 2000 World Wide Web Consortium,
003: * (Massachusetts Institute of Technology, Institut National de
004: * Recherche en Informatique et en Automatique, Keio University). All
005: * Rights Reserved. This program is distributed under the W3C's Software
006: * Intellectual Property License. This program is distributed in the
007: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
010: * details.
011: */
012:
013: package org.w3c.dom.html;
014:
015: import org.w3c.dom.DOMException;
016:
017: /**
018: * The select element allows the selection of an option. The contained
019: * options can be directly accessed through the select element as a
020: * collection. See the SELECT element definition in HTML 4.0.
021: * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
022: */
023: public interface HTMLSelectElement extends HTMLElement {
024: /**
025: * The type of this form control. This is the string "select-multiple"
026: * when the multiple attribute is <code>true</code> and the string
027: * "select-one" when <code>false</code> .
028: */
029: public String getType();
030:
031: /**
032: * The ordinal index of the selected option, starting from 0. The value
033: * -1 is returned if no element is selected. If multiple options are
034: * selected, the index of the first selected option is returned.
035: */
036: public int getSelectedIndex();
037:
038: public void setSelectedIndex(int selectedIndex);
039:
040: /**
041: * The current form control value.
042: */
043: public String getValue();
044:
045: public void setValue(String value);
046:
047: /**
048: * The number of options in this <code>SELECT</code> .
049: */
050: public int getLength();
051:
052: /**
053: * Returns the <code>FORM</code> element containing this control. Returns
054: * <code>null</code> if this control is not within the context of a form.
055: */
056: public HTMLFormElement getForm();
057:
058: /**
059: * The collection of <code>OPTION</code> elements contained by this
060: * element.
061: */
062: public HTMLCollection getOptions();
063:
064: /**
065: * The control is unavailable in this context. See the disabled
066: * attribute definition in HTML 4.0.
067: */
068: public boolean getDisabled();
069:
070: public void setDisabled(boolean disabled);
071:
072: /**
073: * If true, multiple <code>OPTION</code> elements may be selected in
074: * this <code>SELECT</code> . See the multiple attribute definition in
075: * HTML 4.0.
076: */
077: public boolean getMultiple();
078:
079: public void setMultiple(boolean multiple);
080:
081: /**
082: * Form control or object name when submitted with a form. See the name
083: * attribute definition in HTML 4.0.
084: */
085: public String getName();
086:
087: public void setName(String name);
088:
089: /**
090: * Number of visible rows. See the size attribute definition in HTML 4.0.
091: */
092: public int getSize();
093:
094: public void setSize(int size);
095:
096: /**
097: * Index that represents the element's position in the tabbing order. See
098: * the tabindex attribute definition in HTML 4.0.
099: */
100: public int getTabIndex();
101:
102: public void setTabIndex(int tabIndex);
103:
104: /**
105: * Add a new element to the collection of <code>OPTION</code> elements
106: * for this <code>SELECT</code> . This method is the equivalent of the
107: * <code>appendChild</code> method of the <code>Node</code> interface if
108: * the <code>before</code> parameter is <code>null</code> . It is
109: * equivalent to the <code>insertBefore</code> method on the parent of
110: * <code>before</code> in all other cases.
111: * @param element The element to add.
112: * @param before The element to insert before, or <code>null</code> for
113: * the tail of the list.
114: * @exception DOMException
115: * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
116: * the <code>SELECT</code> element.
117: */
118: public void add(HTMLElement element, HTMLElement before)
119: throws DOMException;
120:
121: /**
122: * Remove an element from the collection of <code>OPTION</code> elements
123: * for this <code>SELECT</code> . Does nothing if no element has the given
124: * index.
125: * @param index The index of the item to remove, starting from 0.
126: */
127: public void remove(int index);
128:
129: /**
130: * Removes keyboard focus from this element.
131: */
132: public void blur();
133:
134: /**
135: * Gives keyboard focus to this element.
136: */
137: public void focus();
138:
139: }
|