Page 1 of 1

How to refresh DIV / DIV tag frissitése JavaScripttel

PostPosted: 2013.04.02. 18:23
by rtuszendi
How to refresh DIV / DIV tag tartalmának frissitése JavaScripttel


You the setInterval method of window obj to set the refersh interval and the javascript function which should be invoked on refresh. In the javascript function, update the div content. Something like this should work:


Code: Select all
<html>
   <head>
      <script langauge="javascript">
         var counter = 0;
         window.setInterval("refreshDiv()", 5000);
         function refreshDiv(){
            counter = counter + 1;
            document.getElementById("test").innerHTML = "Testing " + counter;
         }
      </script>
   </head>
   <body>
      <div id="test">
         Testing
      </div>
      <div id="staticBlock">
         This is a static block
      </div>
   </body>
</html>