.
Javasuck - Grin with cat attached — LiveJournal
Previous Entry Next Entry
Javasuck Dec. 5th, 2002 04:53 pm
An HTML page with two identical <SELECT> controls.
( [=< etc):


[SELECT name="select1"]
[OPTION value="3"]A[/OPTION]
[OPTION value="5"]B[/OPTION]
[OPTION value="7"]C[/OPTION]
[OPTION value="9"]D[/OPTION]
[/SELECT]


[SELECT name="select2"]
[OPTION value="3"]A[/OPTION]
[OPTION value="5"]B[/OPTION]
[OPTION value="7"]C[/OPTION]
[OPTION value="9"]D[/OPTION]
[/SELECT]

Javascript OnChange routine sets: select1.value=select2.value

Set select2 to A, (offset=0,value=3).

In IE-MAC, select1 will now be D (offset=3, value=7)
In MOZ-MAC and IE-WIN, select1 will now be A (offset=0, value=3)



This is a bloody PITA. Or am I just nuts?

From: wechsler
Date: December 5th, 2002 - 09:41 am (Link)
Hrm. Since the lists are identical maybe I should just do it by selected index.
From: djm4
Date: December 5th, 2002 - 09:53 am (Link)
In all versions of JavaScript I've worked with (which admittedly isn't that many and not at the bleeding edge of JavaScript development), the value property of a Select object has been considered meaningless. Each of the Option objects in a Select object has a value (which you can, indeed, set), but the Select object itself doesn't.

Inconvenient, certainly, but I can understand why it's like that.
From: wechsler
Date: December 5th, 2002 - 09:59 am (Link)
Well, the thing is that it works in Moz and on Windows, as I'd expected, and the .value property is equal to the value= attribute of the currently selected option.

If the .value property (or setting it, at least) were supposed to have no purpose, it shouldn't be possible to set it.

Still, I'll sort this out tomorrow.
(no subject) - (Anonymous)
From: wechsler
Date: December 5th, 2002 - 11:05 am (Link)
Yes, I know... logic and computers, bad combination.