Closed
Bug 89425
Opened 24 years ago
Closed 24 years ago
javascript select on multiple select box is malfunctioning
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: mozbugs, Assigned: jst)
References
()
Details
Attachments
(1 file)
639 bytes,
text/html
|
Details |
Recently javascripted form.select[val].selected = true; calls are getting wiped
away in 9.2.
See for yourself: http://www.aocsolutions.com/show_moz_select_error.html
Comment 1•24 years ago
|
||
Here is a synopsis of the HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="f" id="f">
<select name="s" id="s" multiple="multiple">
<option>0</option>
</select>
<input type="button"
value="try it"
onclick="document.f.s.length += 1;
document.f.s[document.f.s.length-1].text = 'select me';
document.f.s[document.f.s.length-1].selected = true;
for (var c=document.f.s.length-1; c >-1;c--)
alert (c + ' is selected ? ' + document.f.s[c].selected);
for (var c=document.f.s.length-1; c >-1;c--)
alert (c + ' is selected ? ' + document.f.s[c].selected);"
/>
</form>
</body>
</html>
Comment 2•24 years ago
|
||
Reduced testcase:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Bug 89425</title>
</head>
<body>
<form name="f" id="f">
<select name="s" id="s" multiple="multiple">
<option>Option 0</option>
<option>Option 1</option>
<option>Option 2</option>
</select>
<input type="button"
value="try it"
onclick="document.f.s.length += 1;
var len = document.f.s.length;
document.f.s[len - 1].text = 'Option ' + (len -1);
document.f.s[0].selected = true;" />
</form>
</body>
</html>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•24 years ago
|
||
Comment 4•24 years ago
|
||
The reduced testcase is trying to select the topmost option in the
selectbox. This works in NN4.7, but not in Mozilla 20010628xx.
If we remove these three lines of code:
document.f.s.length += 1;
var len = document.f.s.length;
document.f.s[len - 1].text = 'Option ' + (len -1);
Then the selection of the topmost option works just fine:
document.f.s[0].selected = true;
Somehow the first three lines are preventing the fourth line from working.
Reassigning to DOM Level 0 for further analysis -
Component: Javascript Engine → DOM Level 0
OS: Windows NT → All
Comment 7•24 years ago
|
||
This is WFM on 0.9.4 and 2001092113 Linux. The first option gets selected after
the last option is added.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•