Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MSIE: checkbox onchange

    I have this simple function:
    Code:
    function SH() {
    if (document.getElementById("isID")) {
      document.getElementById("isID").style.display="none";
      document.getElementById("mycheckbox").onchange=function() {
       document.getElementById("isID").style.display=(this.checked)?"block":"none";
      }
    }
    }
    That works on Firefox, but in MSIE not: is seems as if IE gets "onchange" for the checkbox only if its value is true and only if the user clicked on the LABEL of the checkbox. Also, if the user clicks the checkbox itself that function don't work at all.

    Why?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Use onclick instead of onchange.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Aug 2006
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So simple. Thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •