Rotating through Values in a Table Cell - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:TableData

Description

Rotating through Values in a Table Cell

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script type="text/javascript">
var n = 0;/*from w  w  w. j av  a2  s  . co m*/
document.write("<table>");
var i;
for(i=0;i<10;i++){
    document.write('<tr><td id="Cell' + i + '">'+i+'</td></tr>\n');
}
document.write("</table>");

function makeTable(){
    n++;
    for(i=0;i<10;i++){
        var cell="Cell"+i;
        document.getElementById(cell).innerHTML=n + i;
    }
    timer();
}

function timer(){
    setTimeout(makeTable,5000);
}
timer();

      </script>  
   </body>
</html>

Related Tutorials