Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <script> function changeContent(id, row, cell, content) { var x = document.getElementById(id).rows[row].cells; x[cell].innerHTML = content; } </script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <table id="myTable" border="1"> <tr> <td>Row1 cell1</td> <td>Row1 cell2</td> </tr> <tr> <td>Row2 cell1</td> <td>Row2 cell2</td> </tr> <tr> <td>Row3 cell1</td> <td>Row3 cell2</td> </tr> </table> <p> <input type="button" onclick="changeContent('myTable', 0, 0, 'Hello')" value="Change content"> </p> </body> </html>
Result: