Failed to add gif to webpage using javascript

I have a webpage with a link called "Download". When the user clicks this link, I use javascript to add gif animations so that the user knows that the system is busy. Here is the code:

function submit_form()
{
  var nfy = document.getElementById('nfy_area');
  var img = document.createElement( 'img' );
  img.setAttribute('src', 'images/wait24trans.gif');
  nfy.innerHTML = "This will take a few minutes. Please be patient...";
  nfy.appendChild( img );
  document.forms["download_form"].submit();
}

However, this only works for Opera. For Chrome, nothing is displayed. For Firefox, a broken image is displayed.

Why?

Thank,

+3
source share
3 answers

SOLVED: The purpose of the submit action is another page. Thus, both FF and Chrome detect this and stop loading anything else on the current page. I put a delay before submitting the form, and now it works fine.

Commendable, Opera works just fine.

0
source

firefox, , , src.

0

For what it's worth, the HTML5 specification is likely to require a call to submit()imply a call stop().

0
source

All Articles