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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.