Jump to content

[SOLVED] onsubmit display animated gif, works in ff or ie but not both


scarhand

Recommended Posts

I want to display an animated gif below a submit button onclick. I can get the image to display fine, but it is not animated in both browsers.

 

This code works in FF but not IE by toggling the display style of the div from "none" to "block":

 

<form method="post">

<input name="submit" type="submit" value="Add domain" onclick="document.getElementById('working').style.display='block'">

<div id="working" style="display: none; margin-top: 2px;"><img src="images/working.gif" style="vertical-align: middle;"> Please wait while the connection is tested</div>

</form>

 

This code works in IE but not FF by redrawing the image using innerHTML:

 

<form method="post">

<input name="submit" type="submit" value="Add domain" onclick="document.getElementById('working').innerHTML='<img src=\'images/working.gif\' style=\'vertical-align: middle;\'> Please wait while the connection is tested'">

<div id="working" style="margin-top: 2px;"> </div>

</form>

 

I can't get this simple thing to work in both browsers. Its one or the other, and its beyong frustrating.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.