title: Changing <img src="XXX" />, js event when new image has finished loading?
body: <p>I have a photo gallery web page where a single <code>&lt;img src=&quot;XXX&quot; /&gt;</code> element's <code>src</code> is changed (on a click) with JavaScript to show the next image—a poor man's ajax I guess. Works great on faster connections when the new image appears almost immediately. Even if it takes a few seconds to load, every browser I've tested it on keeps the old image in place until the new one is completely loaded.</p>
  <p>It's a little confusing waiting those few seconds on a slow connection, though, and I'm wondering if there's some JavaScript event that fires when the new image is done loading, allowing me to put a little <em>working...</em> animated gif or something up in the meantime.</p>
  <p>I know I could use AJAX for real (I'm using jQuery already), but this is such a nice and simple solution. Besides this lag, is there any other reason I should stay away from this approach to changing images?</p>