Differences Between OnChange In Internet Explorer and Firefox
Written by Chris Anderson
Friday, 11 December 2009 14:59
I just spent way too long trying to figure out why some dynamic html I was modifying in Javascript wouldn't update until I clicked elsewhere on the screen. I had two radio buttons and depending on which one you clicked, further information related to that button would appear dynamically inside the table. In Firefox (as usual) everything worked great right away but in Internet Explorer it wouldn't work until I clicked somewhere else on the page.
Well, and this is the part that took me way too long, it turns out it wasn't just clicking on the page but, more specifically, taking focus away from the radio button. Voila! It was simply a difference in when the onchange event was firing in the different browsers. Internet Explorer waits until focus is lost on the controlling object (not really that bizarre of a behavior when compared to, say, a textbox) whereas Firefox fired it as soon as the value of the radio button group had changed.
I'm not going to pick a favorite among them but thought it would be valuable to note this in case someone else is having the same problem.
My solution was to have the function called on the onclick event instead of the on change and added some logic to catch if the radio button didn't have a value (the user clicked it but didn't get it to select).
Now, if only I could get dynamic table rows to appear with the proper formatting in Firefox. For some reason when I assign a large colspan to a table cell it still is only inhabiting the first cell in the table which throws off the whole layout. In this case, IE does what I want it to do. Is there no end to this cross-browser compatibility struggle?
Comments (0)
Last Updated on Friday, 11 December 2009 15:17
Welcome to Out On A ZiMB!
Written by Chris Anderson
Wednesday, 11 November 2009 21:05
Welcome! This will be the location (finally finalized) where we post tips, tricks, code and our development diary as we find new and interesting things relating to PHP, Joomla!, the IBM i, and ZiMB Manager. We are very excited about the initial release (very, very alpha) of ZiMB Manager and look forward to finalizing that tool as well as eventually providing ZiMB Studio to really kick your IBM i web development into high gear.
In the coming weeks, we'll be sharing some of the important things we've learned building a component that works on both iAMP and LAMP systems. Suffice it to say, there are some major differences (AIX isn't case sensitive?) between the environments and some interesting coding workarounds to go with.