Problem with display:block / none in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • azerva
    New Member
    • Jun 2010
    • 1

    Problem with display:block / none in IE

    Hello there,

    i have a small javascript that toggles one of two <div>'s from display:none to display: block. This works perfectly in every browser, except IE (obviously). Can anyone think why?

    Here is the code:

    Code:
    function toggleDiv(id)
    {
    	document.getElementById("optdiv1").style.display = "none";
    	document.getElementById("optdiv2").style.display = "none";
    
    	document.getElementById(id).style.display = "block";
            document.getElementById("select_2").selectedIndex = 0;
    }
    
    function hideDivs()
    {
    	document.getElementById("optdiv1").style.display = "none";
    	document.getElementById("optdiv2").style.display = "none";
    }
    the functions are called with an onClick event of a drop down menu item (<select> tag).

    Thank you!
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    It may be possible that IE does not recognize onclick. Could onchange work for what you need?

    Comment

    Working...