Closed Bug 26764 Opened 25 years ago Closed 25 years ago

Select.options.length is read-only when it shouldn't be

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED DUPLICATE of bug 16879

People

(Reporter: mjhans, Assigned: vidur)

Details

In javascript 1.1, you are supposed to be able to clear a select list by setting
.options.length=0 (quote O'Reilly p671 of "JavaScript definitive guide", "If you
set options.length to 0, all options in the Select object are cleared").

However, if you execute the following code, you will get the (incorrect) error:

	JavaScript Error: Error: document.F.G.options.length is read-only

There are quite a few sites (including one I'm working on) that make dynamic
menus this way.

Here is some code:

<BODY ONLOAD="clearSelect();">
<HTML>
<SCRIPT LANGUAGE="JAVASCRIPT1.1">

function clearSelect() {
document.F.G.options.length=0;
}
</SCRIPT>
<FORM NAME="F">
<SELECT NAME="G">
<OPTION VALUE="FOO">FOO
</SELECT>
</FORM>
</HTML>
</BODY>


-- Matt
This is a DOM issue. Reassigning.
Component: Core → DOM Level 0
Product: Rhino → Browser
Reassign to owner of DOM component.
Assignee: norris → vidur
QA Contact: cbegle → desale

*** This bug has been marked as a duplicate of 16879 ***
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
verified dupe of bug 16879 "select.options.length should be read/write."
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.