#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0

    Selectbox stays on first option instead of 'selected' Option in IE ( DHTML )


    Hi,

    Situation:
    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, ...
    I have a javascript wich loads the correct block into the page, depending on the selectedIndex of Selectbox1 ( which is also a part of each block )
    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

    Problem:
    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
    Attached Files
    Last edited by koendb; August 5th, 2003 at 11:22 AM.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Netherlands
    Posts
    26
    Rep Power
    0
    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....
    Attached Files
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0
    Ok thanks, that solved the problem indeed

IMN logo majestic logo threadwatch logo seochat tools logo