document.getElementById is not working in firefox and netscape


I want to show the status bar image when the form is submitted until the next page loads, and  i am using <DIV> to do this, the following code perfectly works in the IE, but not in the FireFox.

in the body

<div id="statusMessage" style="display:none" class="textcenter"><img id="statusMessage"src="img/animatedstatus2.gif"></div>

The javascript:

function submitFilesFForm()
  document.getElementById('ListFiles').disabled = true;


<form method=POST name=filesform action="listfiles.html"  >
<div class="textcenter">
  <input type="SUBMIT" name = "ListFiles" value="View Files"onclick="submitFilesFForm()" > <br><br>  

The form is getting submitted properly, but the statuse bar is not getting displayed when the next page loads, Does this document.getElementById() work in Non IE browsers? ANy alternatives that I can use instead of this  document.getElementById()?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


      if (document.all&&document.getElementById) {
            navRoot = document.getElementById("nav");


does work in ns and firefox.  

I suspect that the code is bombing out in the line above where you're not using getElementByID to reference the DOM object.  Try adding an alert before and after the line   document.filesform.submit(); to see if they both display.  

Important: make sure your spacing is correct in your html tags (no space before and after the "=" sign and a space before each tag attribute).

You need to specify an ID if you want to use (firefox is more strict then IE when it comes to the standards):
  <input type="SUBMIT" name="ListFiles" id="ListFiles" value="View Files" onclick="submitFilesFForm()">

Also, I would change the display property before submitting the form:
function submitFilesFForm()
  document.getElementById('ListFiles').disabled = true;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
statusMessage is being used as the id on two different elements.  The standards require that id be unique within a page.  IE which does not comply with the standards tries, successfully it would appear to resolve the erroneous declarations.  FF and NS instead quit executing the code when the hit the reference to the illegal id.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.