日期:2014-05-16  浏览次数:20311 次

使用Javascript动态增加,删除表格(使用W3C对象模型)

使用Javascript动态增加,删除表格(使用W3C对象模型)

<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>

<script?language="javascript">
??
function?deleteRow(index){
????
var?rowObj=document.getElementById('row'+index);
????tableObj.removeChild(rowObj);
??}

??
function?addRow(){
?????
var?tableBodyObj=document.getElementById("mainBody");
?????newRowObj.id
="row"+(tableObj.rows.length-1);