1.对表格进行动态移动删除操作例子:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>made by meixx</title>
<style type="css/text">
body{font-size:10pt}
</style>
<script language="javascript">
<!--
var curRowSource=null;
var curRowTarget=null;
function selectRow(obj){
 if(curRowSource){
  curRowSource.style.backgroundColor="#FFFFFF";
  curRowSource.style.color="#000000";
 }
 obj.style.backgroundColor="#3366FF";
 obj.style.color="#FFFFFF";
 curRowSource=obj;
 var btns=document.getElementsByName("btn");
 btns[0].disabled=false;
}
function selectRow1(obj){
 if(curRowTarget){
  curRowTarget.style.backgroundColor="#FFFFFF";
  curRowTarget.style.color="#000000";
 }
 obj.style.backgroundColor="#3366FF";
 obj.style.color="#FFFFFF";
 curRowTarget=obj;
 var btns=document.getElementsByName("btn");
 btns[2].disabled=false;
}
function Add(tbSou,tbTar){
 var rowSou=null;
 var newRow=tbTar.insertRow();
 if(tbSou.id=="tbSource"){
  rowSou=curRowSource;
  newRow.attachEvent("onclick",function(){selectRow1(newRow);});
 }
 else{
  rowSou=curRowTarget;
  newRow.attachEvent("onclick",function(){selectRow(newRow);});
 }
 for(var i=0;i<rowSou.cells.length;i++){
  var newCell=newRow.insertCell();
  newCell.innerHTML=rowSou.cells[i].innerHTML;
 }
 tbSou.deleteRow(rowSou.rowIndex);
 var btns=document.getElementsByName("btn");
 btns[0].disabled=true;
 btns[2].disabled=true;
}

function AddAll(tbSource,tbTarget){
 for(var i=1;;i++){
  if(tbSource.rows.length==1) return;
  tbSource.rows[1].click();
  Add(tbSource,tbTarget);
 }
 
}
function doSubmit(){
 SelectAll(frmDisplay.dltTarget); 
 //frmDisplay.action="";//设置form 提交的action
 alert(frmDisplay.action);
 //frmDisplay.submit();//取消注释即可,提交上去的options
}
//->
</script>
</head>

<body>
<table width="550" border="1" style="border-collapse:collapse " bordercolor="#111111" cellpadding="0" cellspacing="0">
  <tr>
    <td width="250" valign="top">
  <table >2
 </td>
  </tr>
</table>

</body>
</html>

2.动态添加表格:

<table ;
tr.parentNode.insertBefore(n,tr);
}
//-->
</script>

相关文章:

  • 2022-02-21
  • 2022-12-23
  • 2021-12-07
  • 2021-10-11
  • 2021-12-24
  • 2022-01-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-07-20
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案