title: JavaScript setInterval does not work with asp net
body: <p>I want the label text run animate when i click to the button, but it's not work. If i use <strong>window.setInterval(afun, 150)</strong> outside the function, the label text will run automatic event i'm not click to the button. Where is my bug ?. Sorry for my bad English.</p>
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
      &lt;div runat="server"&gt;
  
          &lt;p id="demo" runat="server"&gt;
              &lt;asp:Label runat="server" ID="label1"&gt;Animate Text&lt;/asp:Label&gt;
              &lt;asp:Button OnClientClick=" return afun();" Text="button" runat="server" /&gt;
          &lt;/p&gt; 
      &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
  
      function afun() {
          var element = document.getElementById('&lt;%=label1.ClientID%&gt;');
          var eText = element.innerHTML;
          var lengText = eText.length;
          window.setInterval(function () {
              eText = eText[lengText - 1] + eText.substring(0, lengText - 1);
              element.innerHTML = eText;
          },150);
      }
      //window.setInterval(afun, 150);
  &lt;/script&gt;
  </code></pre>