Posts Tagged ‘web development’

Source Control with Git

Thursday, October 16th, 2008

I’ve been using version control for various projects for quite a while now. Basically, it lets you (and your co-developers) track your changes, who added what, merge conflicts, as well as going back in time and reverting your code base to its previous state.

Typically (in Subversion and CVS for example) you will have a central server which all the developers check their code in to. For a project not too long ago I was required to learn git, a distributed version control system. There were a number of reasons for doing so, but the most important (well, in my opinion) are: (more…)

Internet Explorer and Ajax

Tuesday, June 17th, 2008

Okay, I just wasted waaaay too much time trying to track down an apparently odd Internet Explorer redraw issue. The problem was an ajax call associated with the onchange of a checkbox form element. In Firefox this worked perfectly. Click the button, the div updates itself. However, in IE 6 and 7 it would just sit there and do nothing until you would force a redraw (ctrl +a seemed to do it), or scrolled the page up & down a few times.

It turns out, this was because of the way IE handles the onchange javascript event. This only fires once the checkbox loses focus. To fix this, I just switched from the onchange event to the onclick event and everything works as expected. I’ll retract some (okay, just one) of my nasty comments about Internet Explorer now as this does make logical sense thinking about it now.

So the offending code looked like

<input type="checkbox" name="mycheckbox" value="something" onchange="update_div();">click me

whereas it should be:

<input type="checkbox" name="mycheckbox" value="something" onclick="update_div();">click me