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. package org.w3c.dom.html;
  13. import org.w3c.dom.DOMException;
  14. /**
  15. * The select element allows the selection of an option. The contained
  16. * options can be directly accessed through the select element as a
  17. * collection. See the SELECT element definition in HTML 4.0.
  18. * <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>.
  19. */
  20. public interface HTMLSelectElement extends HTMLElement {
  21. /**
  22. * The type of this form control. This is the string "select-multiple"
  23. * when the multiple attribute is <code>true</code> and the string
  24. * "select-one" when <code>false</code> .
  25. */
  26. public String getType();
  27. /**
  28. * The ordinal index of the selected option, starting from 0. The value
  29. * -1 is returned if no element is selected. If multiple options are
  30. * selected, the index of the first selected option is returned.
  31. */
  32. public int getSelectedIndex();
  33. public void setSelectedIndex(int selectedIndex);
  34. /**
  35. * The current form control value.
  36. */
  37. public String getValue();
  38. public void setValue(String value);
  39. /**
  40. * The number of options in this <code>SELECT</code> .
  41. */
  42. public int getLength();
  43. /**
  44. * Returns the <code>FORM</code> element containing this control. Returns
  45. * <code>null</code> if this control is not within the context of a form.
  46. */
  47. public HTMLFormElement getForm();
  48. /**
  49. * The collection of <code>OPTION</code> elements contained by this
  50. * element.
  51. */
  52. public HTMLCollection getOptions();
  53. /**
  54. * The control is unavailable in this context. See the disabled
  55. * attribute definition in HTML 4.0.
  56. */
  57. public boolean getDisabled();
  58. public void setDisabled(boolean disabled);
  59. /**
  60. * If true, multiple <code>OPTION</code> elements may be selected in
  61. * this <code>SELECT</code> . See the multiple attribute definition in
  62. * HTML 4.0.
  63. */
  64. public boolean getMultiple();
  65. public void setMultiple(boolean multiple);
  66. /**
  67. * Form control or object name when submitted with a form. See the name
  68. * attribute definition in HTML 4.0.
  69. */
  70. public String getName();
  71. public void setName(String name);
  72. /**
  73. * Number of visible rows. See the size attribute definition in HTML 4.0.
  74. */
  75. public int getSize();
  76. public void setSize(int size);
  77. /**
  78. * Index that represents the element's position in the tabbing order. See
  79. * the tabindex attribute definition in HTML 4.0.
  80. */
  81. public int getTabIndex();
  82. public void setTabIndex(int tabIndex);
  83. /**
  84. * Add a new element to the collection of <code>OPTION</code> elements
  85. * for this <code>SELECT</code> . This method is the equivalent of the
  86. * <code>appendChild</code> method of the <code>Node</code> interface if
  87. * the <code>before</code> parameter is <code>null</code> . It is
  88. * equivalent to the <code>insertBefore</code> method on the parent of
  89. * <code>before</code> in all other cases.
  90. * @param element The element to add.
  91. * @param before The element to insert before, or <code>null</code> for
  92. * the tail of the list.
  93. * @exception DOMException
  94. * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
  95. * the <code>SELECT</code> element.
  96. */
  97. public void add(HTMLElement element,
  98. HTMLElement before)
  99. throws DOMException;
  100. /**
  101. * Remove an element from the collection of <code>OPTION</code> elements
  102. * for this <code>SELECT</code> . Does nothing if no element has the given
  103. * index.
  104. * @param index The index of the item to remove, starting from 0.
  105. */
  106. public void remove(int index);
  107. /**
  108. * Removes keyboard focus from this element.
  109. */
  110. public void blur();
  111. /**
  112. * Gives keyboard focus to this element.
  113. */
  114. public void focus();
  115. }