IE 6 javascript onchange() problem

I really hate IE6, but as it is still so common it is important to support it. I recently ran into a problem with the javascript onchange function. I was using onchange to update a text box on the page when the check box was selected. I was using “…onchange(this.checked)…” This worked fine for everything except IE6. It turns out that IE doesn’t fire the onchange state until the checkbox loses focus and so my update was not occurring.

The simple way around for this problem was to change onchange() to onclick(). The function now works in all browsers.