2

How can i stop "progress bar gif image" when i stopped processing by clicking "Stop Loading This Page" in web browser? When i clicked submit button then loading.gif image is displayed and now if i clicked to stop browser's stop button then also that loading.gif is still running, how can i stop it? Gif should be stopped when browser's stop is clicked but it is not stopping and continuing. How can i solve it?

//Here when submit button is clicked then loading.gif image is displayed

 <input onclick="showImg()" type="submit" name="submit" value="Search"/>

 <img alt="" src="loading.gif" id="progress_img" style="visibility:hidden;">

 <script language="javascript" type="text/javascript">
 function showImg()
 {
 if (document.getElementById) { (document.getElementById("progress_img")).style.visibility = "visible"; }
 }
 </script> 
saroj
  • 643
  • 8
  • 14
  • 25

2 Answers2

1

The challenge is that most solution are browser specific ...

You can try different examples form

Stopping GIF Animation Programmatically

Animated GIF in IE stopping

It has been well discussed

Thanks

:)

Community
  • 1
  • 1
Baba
  • 94,024
  • 28
  • 166
  • 217
0

You can simply hide the gif when the "stop" browser button is clicked.

document.onstop = function() {
     (document.getElementById("progress_img")).style.visibility = "hidden";
}
Nachi
  • 4,218
  • 2
  • 37
  • 58
  • can you please add little bit more as i have written with in script tag , it is not working here – saroj Mar 30 '12 at 10:24
  • Here's a working example: http://help.dottoro.com/ljjvnosr.php (Note that this a sub-optimal solution because it works only in IE) – Nachi Mar 30 '12 at 11:13