I've got a chunk of javascript that's supposed to do something really 
simple, toggle radio buttons on and off (disable/enable)
based on another radio button....

However, there's a bug in IE, 
(http://webbugtrack.blogspot.com/2007/08/bug-152-getelementbyid-returns.html) 
that forces me (I think)
to add some additional code, which under normal circumstances wouldn't 
be a big deal.

The layout that I'm dealing with has multiple nested tables and alot of 
other elements, and re-working the layout is out of the question so...
Is there a way, given the code below. to just deal with the ID's inside 
the form?
Here's the code:

function toggleOnPaidLeave(){
   * // this code corrects javascript bugs in IE and Opera*
        //use browser sniffing to determine if IE or Opera (ugly, but 
required)
        var toggle;
        var isOpera,
        isIE = false;
        if(typeof(window.opera) != 'undefined'){
            isOpera = true;
            }
        if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){
            isIE = true;}
        //fix both IE and Opera (adjust when they implement this method 
properly)
        if(isOpera || isIE){ 
            document.nativeGetElementById = document.getElementById; 
            //redefine it! 
            document.getElementById = function(id){   
                var elem = document.nativeGetElementById(id);   
                    if(elem){     
                    //verify it is a valid match!     
                        if(elem.attributes['id'] && 
elem.attributes['id'].value == id){       
                        //valid match!       
                        return elem;     
                        } else {       
                        //not a valid match!       
                        //the non-standard, document.all array has keys 
for all name'd, and id'd elements       
                        //start at one, because we know the first match, 
is wrong!       
                        for(var 
i=1;i<document.all[id].length;i++){         
                            if(document.all[id][i].attributes['id'] && 
document.all[id][i].attributes['id'].value == id){          
                                 return document.all[id][i];        
                                  }       
                                }    
                             }   
                        }   
                        return null; 
                    };
                }
               
               
 *//this is what I actually want to do*
if(toggle = 1){
            document.getElementById("pre_absent").disabled=true;
            document.getElementById("alternative_week_id").disabled=true;
            document.getElementById("pre_pretransplant").disabled=true;
            document.getElementById("pre_pediatric_clinic").disabled=true;
        }else{
            document.getElementById("pre_absent").disabled=false;
            document.getElementById("alternative_week_id").disabled=false;
            document.getElementById("pre_pretransplant").disabled=false;
            document.getElementById("pre_pediatric_clinic").disabled=false;
        }
       
    }
   

-- 
Scott Stewart
ColdFusion Developer

Office of Research Information Systems
Research &amp; Economic Development
University of North Carolina at Chapel Hill

Phone:(919)843-2408
Fax: (919)962-3600
Email: saste...@email.unc.edu



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319280
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to