KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > dom > html > HTMLSelectElement


1 /*
2  * Copyright (c) 2000 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
9  * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
10  * details.
11  */

12
13 package org.w3c.dom.html;
14
15 import org.w3c.dom.DOMException JavaDoc;
16
17 /**
18  * The select element allows the selection of an option. The contained
19  * options can be directly accessed through the select element as a
20  * collection. See the SELECT element definition in HTML 4.0.
21  * <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>.
22  */

23 public interface HTMLSelectElement extends HTMLElement {
24     /**
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> .
28      */

29     public String JavaDoc getType();
30
31     /**
32      * The ordinal index of the selected option, starting from 0. The value
33      * -1 is returned if no element is selected. If multiple options are
34      * selected, the index of the first selected option is returned.
35      */

36     public int getSelectedIndex();
37     public void setSelectedIndex(int selectedIndex);
38
39     /**
40      * The current form control value.
41      */

42     public String JavaDoc getValue();
43     public void setValue(String JavaDoc value);
44
45     /**
46      * The number of options in this <code>SELECT</code> .
47      */

48     public int getLength();
49
50     /**
51      * Returns the <code>FORM</code> element containing this control. Returns
52      * <code>null</code> if this control is not within the context of a form.
53      */

54     public HTMLFormElement getForm();
55
56     /**
57      * The collection of <code>OPTION</code> elements contained by this
58      * element.
59      */

60     public HTMLCollection getOptions();
61
62     /**
63      * The control is unavailable in this context. See the disabled
64      * attribute definition in HTML 4.0.
65      */

66     public boolean getDisabled();
67     public void setDisabled(boolean disabled);
68
69     /**
70      * If true, multiple <code>OPTION</code> elements may be selected in
71      * this <code>SELECT</code> . See the multiple attribute definition in
72      * HTML 4.0.
73      */

74     public boolean getMultiple();
75     public void setMultiple(boolean multiple);
76
77     /**
78      * Form control or object name when submitted with a form. See the name
79      * attribute definition in HTML 4.0.
80      */

81     public String JavaDoc getName();
82     public void setName(String JavaDoc name);
83
84     /**
85      * Number of visible rows. See the size attribute definition in HTML 4.0.
86      */

87     public int getSize();
88     public void setSize(int size);
89
90     /**
91      * Index that represents the element's position in the tabbing order. See
92      * the tabindex attribute definition in HTML 4.0.
93      */

94     public int getTabIndex();
95     public void setTabIndex(int tabIndex);
96
97     /**
98      * Add a new element to the collection of <code>OPTION</code> elements
99      * for this <code>SELECT</code> . This method is the equivalent of the
100      * <code>appendChild</code> method of the <code>Node</code> interface if
101      * the <code>before</code> parameter is <code>null</code> . It is
102      * equivalent to the <code>insertBefore</code> method on the parent of
103      * <code>before</code> in all other cases.
104      * @param element The element to add.
105      * @param before The element to insert before, or <code>null</code> for
106      * the tail of the list.
107      * @exception DOMException
108      * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
109      * the <code>SELECT</code> element.
110      */

111     public void add(HTMLElement element,
112                     HTMLElement before)
113                     throws DOMException JavaDoc;
114
115     /**
116      * Remove an element from the collection of <code>OPTION</code> elements
117      * for this <code>SELECT</code> . Does nothing if no element has the given
118      * index.
119      * @param index The index of the item to remove, starting from 0.
120      */

121     public void remove(int index);
122
123     /**
124      * Removes keyboard focus from this element.
125      */

126     public void blur();
127
128     /**
129      * Gives keyboard focus to this element.
130      */

131     public void focus();
132
133 }
134
135
Popular Tags