<div class="codetitle"> <span><a style="CURSOR: pointer" data="19849" class="copybut" id="copybut19849" onclick="doCopy('code19849')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code19849"> <br><html><br><head><title>遍历表格</title><br><script language="javascript"><br> function getData()<br> {<br> var arrData=new Array();<br> var objTable=document. getElementById("myTable");<br> if(objTable)<br> {<br> for(var i=0;i<objtable.rows.length> {<br> for(var j= 0;j<objtable.rows> {<br> arrData[i]=objTable.rows[i].cells[j].innerText;<br> }<br> }<br> }<br> alert(arrData.join(","));<br> }<br></script><br></head><br><body><br> <table border="1" id="myTable"><br><tr><td>劉</td><td>ジン</td><td>カイ</td>< ;/tr><br><tr> <br><br> </tr> <tr> <br><br> </tr> <tr> <br><br><br><br> <td>liu3</td><td>jin3</td><td>cai3</td></tr><br></table><form> <input type="button" value="getData" onclick="getData();" /></form></body></html></tr></objtable.rows></objtable.rows.length> </div>