August 5th, 2003, 10:16 AM
Selectbox stays on first option instead of 'selected' Option in IE ( DHTML )
I have 4 blocks of html code
identified with an ID tag
in each of these blocks, I have some form elements, like text input boxes, selectboxes, ...
Selectbox1 contains 4 options, corresponding to a certain block, ( option 1 should load block 1, option 2 should load block 2, etc,... )
The actual values are parsed from a php script
Although the rest of the block is displayed correctly, Internet Explorer (6.0sp1, haven 't tested with IE5.5 or so ) refuses to display the correct selected option in Selectbox1, it always defaults to the first option.
Selecting another option from Selectbox1 still shows the first option, although the rest of the block is that of the option I choose. The selected attributes are hardcoded in each block
Mozilla 1.0.1 doesn't have this problem and shows the page as intended
See attached file ( problem.html ) for the relevant portions of the code
Last edited by koendb; August 5th, 2003 at 10:22 AM.
August 5th, 2003, 05:26 PM
i replaced the onchange code so it is more readable.
But the fix is, that when you clone something, you cant address the selectbox (in this case) with its name. But because you insert it into a form, you can go through the elements list.
And then you can get the 'bastard' and change it selectedIndex.
See the added file....
August 5th, 2003, 07:09 PM
Ok thanks, that solved the problem indeed