<script><br><br> function uf_test(){<br> //得到table对象<br> var tbTable = document.getElementById("tb_test");<br> //插入一行<br> var trT = tbTable.insertRow();<br><br> //得到上一行的td数<br> var nRows = tbTable.rows[0].cells.length;<br><br> //按上一行的td数循环进行插入td<br> for(var i = 0; i < nRows ; i ){<br> //创建td对象<br> var tdT = document.createElement("TD");<br> //给td对象赋值<br> //tdT.innerHTML="sfsdf"; <br> tdT.innerText="sfsdf"; <br> //把td添加到tr中 <br> trT.appendChild(tdT);<br> }<br> }<br><br></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn