Janet
Janet

Reputation: 1411

Please wait Animation gif using javascript

I am trying to use this post in order to get the animated gif for Please wait message.... on button click. However, when I open the sample html page that I am testing on, I get an input box instead of an button with am image.

Below is the html code that I am trying on a test page.

 <html>

 <script type="text/javascript">


  function loadSubmit() {
   var ProgressImage = document.getElementById('progress_image');
  document.getElementById("progress").style.visibility = “visible”;
   setTimeout(function(){ProgressImage.src = ProgressImage.src},100);
   return true;
    }
    </script>

 <body>
   <p style="visibility:hidden;" id="progress">

  <img id="progress_image" style="padding-left:5px;padding-top:5px;" src="ajax-loader.gif" alt=""> Uploading in progress…      </p> 
    <input class="contSubmit" onclick="return loadSubmit()" type=”button” src= "submitinfo_btn.png" /> 

     </body>
   </html>

Upvotes: 0

Views: 2839

Answers (3)

Matt Burland
Matt Burland

Reputation: 45135

Change your input type to image. The src is only valid for image.

Also, it appears your problem has nothing to do with your "please wait" animated gif, so maybe your title is misleading.

Upvotes: 0

Christophe
Christophe

Reputation: 28114

According to your tutorial, the input should be of type "image", not "button".

Upvotes: 1

Stefan
Stefan

Reputation: 2194

Be careful when copy-pasting Code like this. This is wrong:

type=”button”

This is right:

type="button"

Notice the difference? This happens if you copy Code from a website that doesn't have proper formatting for Code enabled.

Upvotes: 2

Related Questions