var frm = document.zipForm;
var state = nme.substring(3,nme.length);
var img = document.getElementById("processing");
var el = document.getElementsByTagName("input");
img.style.display = "block";
for (var i = 0; i < el.length; i++)
if ((el[i].type == "checkbox") && (el[i].name.indexOf("CT_" + state + "_") == 0))
el[i].checked = frm.elements[nme].checked;
img.style.display = "none";
<div id="processing" style="z-index: 1; position: absolute; top: 600px; left: 500px; display: none">
<img style="width: 50px" src="images/processing.gif">
The image is just one of those animated wheels. You can see it here: https://www.ohprs.org/ohprs/images/processing.gif
. When an onclick calls the setState function, I do not see the animation. However, if I put 'alert(img.style.display);
' after line 8, it does show the image. But even then, as soon as I click 'OK' the image freezes and ceases to animate. It does disappear after line 19.
Even if I have just some text like "Please Wait" instead of the image, It doesn't show unless I have an alert() after setting the display style.
This must be a relatively common need. What am I doing wrong?