Get specific table cell - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:TableData

Description

Get specific table cell

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//w  w  w  .ja va  2 s  . com
var score = parseInt(document.getElementById('score').innerHTML);
document.getElementById('score').innerHTML = score + 1;
    }

      </script> 
   </head> 
   <body> 
      <table> 
         <tbody>
            <tr> 
               <td>score</td> 
               <td id="score">2</td> 
            </tr> 
         </tbody>
      </table>  
   </body>
</html>

Related Tutorials