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

js动态增加行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

<script type="text/javascript">

function Reset() {
var f = document.forms[0];
alert(f.id);
f.reset();
}
function getTD() {
var newtd = document.createElement("td");
newtd.setAttribute("align", "left");
newtd.style.backgroundColor = "#ffffff";
newtd.setAttribute("valign", "top");

newtd.style.BORDERRIGHT="windowtext 1pt solid";
newtd.style.PADDINGRIGHT="5.4pt";
newtd.style.BORDERTOP="medium none";
newtd.style.PADDINGLEFT="5.4pt";

  //PADDING-BOTTOM:0cm; BORDER-LEFT:medium none; WIDTH:45.8pt; PADDING-TOP:0cm; BORDER-BOTTOM:windowtext 1pt solid; mso-border-alt:solid windowtext .5pt; mso-border-left-alt:solid windowtext .5pt; mso-border-top-alt:solid windowtext .5pt'
return newtd;
}

function getGoosList() {

  var table = document.getElementById("Table1");
     
      var trs = table.getElementsByTagName("tr");
      var tds = trs[3].getElementsByTagName("td");
   
   
    
      var str1="";
  for ( var i = 0; i < tds.length-1; i++) {
 
  for(var j=3;j<trs.length-1;j++){
             if(table.rows[j].cells[i].children(0)){
            
                str1 +=","+table.rows[j].cells[i].children(0).value;
              
             }
       
        table.rows[j].cells[i].children(0).value="";

         }
 
                table.rows[3].cells[i].children(0).value=str1.substr(1,str1.length);
                str1="";
               
       }


}
function getValue(){
var  table = document.getElementById("Table1");
var trs = table.getElementsByTagName('tr');

var str=table.rows[3].cells[0].children(0).value;

  if(str!=""){

      var s = str.split(",");
  
      
       var len=trs.length-4;
     
      for(var i=0;i<s.length-len;i++){
    
         getGoods();    
    }
var trs = table.getElementsByTagName('tr');
   var tds = trs[3].getElementsByTagName("td");
for ( var i = 0; i < tds.length-1; i++) {
       var str= table.rows[3].cells[i].children(0).value;
       str = str.split(",");
  for(var j=3;j<