Keep an Animated GIF Going After Form Submits

后端 未结 3 1211
萌比男神i
萌比男神i 2021-01-24 04:38

The following works for me in ie6,ie7,chrome but not ff3

document.getElementById(\"form-name\").submit();
var image = document.getElementById(\"loader-img\");
se         


        
3条回答
  •  广开言路
    2021-01-24 04:53

    Have you tried removing the image node and replacing it? Something like:

    var image = document.getElementById("loader-img");
    image.parentNode.removeChild(image);
    image.parentNode.appendChild(image);
    

    (You might also need to do image.cloneNode(true) in between the remove and append calls.)

    Obviously, your HTML needs to be structured so that this doesn't goof up the display.

    But, what knut said applies (posting into a hidden IFRAME or using XHR will give you more control). And I'm not sure what you meant by "it's not a form submit, it is a document.location='url' call", so if you clarify the use case and workflow, I might be able to help more.

提交回复
热议问题