日期:2014-05-16 浏览次数:20332 次
<!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>
<script type="text/javascript">
function f1(){ //新增行
var i=0
var Mytable=document.getElementById('Mytable');
var objrow = Mytable.insertRow(1);
for(i=0;i<4;i++){
var objcell = objrow.insertCell(i);
objcell.innerHTML = document.getElementById("td"+i).innerHTML;
}
}
function f2(){
var inputs=document.getElementsByTagName('input');
var Mytable=document.getElementById('Mytable');
var a=[];
for(var i=0;i<inputs.length;i++){
if(inputs[i].type=='checkbox'){
a.push(inputs[i]);
}
}
for(var i=a.length-1;i>=0;i--){
if(a[i].checked){
Mytable.deleteRow(i+1);
}
}