自己动手-修改表格内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><table width="200" border="1" id="nameList"> <tr> <td>茶叶</td> <td>茶叶</td> <td>茶叶</td> </tr> <tr> <td>茶叶</td> <td>茶叶</td> <td>茶叶</td> </tr> <tr> <td>茶叶</td> <td>茶叶</td> <td>茶叶</td> </tr></table><p> <input type="submit" name="button" id="button" value="修改内容" onclick="changeTableData();"/></p><script type="text/javascript">function changeTableData(){var nameListTable=document.getElementById("nameList");//获得表格行数var tbRows=nameListTable.rows;var rowsLen=tbRows.length;for ( var i = 0; i < rowsLen; i++) {//获得每行单元格个数var cellsLenPerRow=tbRows[i].cells.length;for ( var j = 0; j < cellsLenPerRow; j++) {tbRows[i].cells[j].innerHTML="macrotea";}}}</script></body></html>
?