SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist NokX's Avatar
    Join Date
    Feb 2003
    Location
    Knoxville, TN
    Posts
    531
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE issue with disabling/enabling elements

    i have two radio buttons. depending on which one is checked certain elements are disabled or enabled. in firefox - this works perfectly. in IE it "works", but the changes are only noticed when you click on the page somewhere...which makes no sense.

    for example, my script looks like this...

    Code:
    // "sync-device-network" is one of the radio elements
    
    syncType = function() {
        var formNetwork = document.getElementById("form-network");
        var formManual = document.getElementById("form-manual");
        if (document.getElementById("sync-device-network").checked == true) {
            for (i = 0; i < formNetwork.elements.length; i++){
                   if (formNetwork.elements[i].type == "text" || formNetwork.elements[i].type == "select-one") {
                    formNetwork.elements[i].disabled = null;
                }
            }
            for (i = 0; i < formManual.elements.length; i++){
                   if (formManual.elements[i].type == "text" || formManual.elements[i].type == "select-one") {
                    formManual.elements[i].disabled = "disabled";
                }
            }
        } else {
            for (i = 0; i < formNetwork.elements.length; i++){
                   if (formNetwork.elements[i].type == "text" || formNetwork.elements[i].type == "select-one") {
                    formNetwork.elements[i].disabled = "disabled";
                }
            }
            for (i = 0; i < formManual.elements.length; i++){
                   if (formManual.elements[i].type == "text" || formManual.elements[i].type == "select-one") {
                    formManual.elements[i].disabled = null;
                }
            }
        }
    }
    maybe there's a workaround to what i'm doing or maybe i have to do some other method all together?

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try setting the disabled property to true/false instead of null/"disabled".
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Evangelist NokX's Avatar
    Join Date
    Feb 2003
    Location
    Knoxville, TN
    Posts
    531
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tried it - still delaying. makes no sense.


Bookmarks

Posting Permissions

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