To show "wait" indicator I'm using that function:
Code:
// divID - ID of some div
// divBackground - url of the loading image
function picBack(divID, divBackground) {
var d=document.getElementById(divID);
if(divBackground=="" || d==null) {noBG(divID); return;}
var img = new Image();
d.style.backgroundImage = 'url(img/wait.gif)';
img.onload = function() { d.style.backgroundImage = 'url(' + img.src + ')'; };
img.src = divBackground;
Until divBackground is loaded - script showing animated wait.gif.
There is a key: img.onload= must be before img.src=
I dont sure could this help, but it seems alike.