title: How to display Loading image Before Redirecting to another page?
body: <p>I have an image for loading. I am using onclick method to redirect so when somebody click on a div, it takes them to another page. How would i be able to load a loading.gif image while the the page is redirecting to the another one. I would really like to use this as this would be more user friendly and my page that is loading usually takes about 15 seconds. I've tried the below code but it is not working.</p>
  
  <p>Here is my code,</p>
  
  <pre><code>&lt;div data-align="center" id="mainDiv" style="height:100%; background-image:url('images1/pattern1.png')"&gt;
      &lt;table id="login"&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;
                  &lt;span&gt;UserName :&lt;/span&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" id="txtUsername" runat="server"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;
                  &lt;span&gt;Password :&lt;/span&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="password" id="txtPassword" runat="server"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td colspan="2" align="center"&gt;
                  &lt;input type="button" class="LoginButton" value="Login" onclick="Login();"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;span id="loading" style="visibility: hidden; text-align: center;"&gt;
      &lt;img src="images1/loading.gif" id="Img5" data-transition="slide" /&gt;
  &lt;/span&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
     function Login() {
      document.getElementById("mainDiv").style.visibility = 'hidden';
      document.getElementById("loading").style.visibility = 'visible';
      location = "Default.aspx";
      };
  &lt;/script&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks.</p>