jquery doesn't work with this layout, that's the first place I went. Adrian Lynch wrote: > I know, I hate it sometimes too when you ask a question and someone says, > "don't do it that way, do it this completely different way", but, jQuery! > > <script type="text/javascript" src="/scripts/jquery-1.3.1.min.js"></script> > <script type="text/javascript"> > $(function() { > > > $(".checkAll").change(function() { > > if (this.checked) { > var checked = "checked"; > } else { > var checked = ""; > } > > $("input.checkGroup", > $(this).parent()).attr("checked", checked); > > }); > > }); > </script> > > <cfoutput> > > <h2>Group 1</h2> > <div> > All <input type="checkbox" class="checkAll" /><br /> > <cfloop from="1" to="10" index="i"> > #i# <input type="checkbox" class="checkGroup" /><br /> > </cfloop> > </div> > > <h2>Group 2</h2> > <div> > All <input type="checkbox" class="checkAll" /><br /> > <cfloop from="1" to="10" index="i"> > #i# <input type="checkbox" class="checkGroup" /><br /> > </cfloop> > </div> > > </cfoutput> > > Download jQuery, change the path to it and run this. > > Adrian > > >> -----Original Message----- >> From: Scott Stewart [mailto:saste...@email.unc.edu] >> Sent: 13 February 2009 16:11 >> To: cf-talk >> Subject: Javascript question >> >> >> 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 & 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:319285 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4