IE-induced WTF



  • I wouldn't necessarily say that this is a real IE WTF, but the code I had to write for it sure is.

     

    function onload_func(){

    document.getElementById('some_multiselect_box').selectedIndex = document.getElementById('some_multiselect_box').selectedIndex;

    }

     


     When a page loads, IE won't scroll a multiple-select box to the initially selected item (Firefox does). Changing the selected item, though, scrolls the box to the correct place.



  • Why not just specify the selected item in the source?  No javascript required.



  • Read the last part again. Also note that there is no previous Javascript setting the selected element, only the HTML source.


Log in to reply