function addItem(tblname) {
var newRow;
var newCell; newRow = document.all[tblname].insertRow(); newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='ip_no' size='9' maxlength='6' value><input type='hidden' name='low' value>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='accry' size='15' maxlength='12' value>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='accry_std' size='60' maxlength='40' value>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='buy_price' size='10' maxlength='7' datatype='number' class='number'  onblur='addCommaFloat(this)' onfocus='remComma(this)' value>&nbsp<select name='buy_curr' size='1'><%=strCurrOption%></select>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='hidden' name='quantity' value><span id='showQuantity'></span>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<select name='unit' size='1'><%=strUnitOption%></select>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<select name='order_type' onchange='judgeOrdDisable(this);' size='1' ><%=strOrderTypeOption%></select>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<div align='center'><select name='pay_type' onchange='judgePayDisable(this);' size='1' STYLE='background:#cccccc' disabled><%=strPayTypeOption%></select></div>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='sale_price' size='10' maxlength='7' datatype='number' class='number'  onblur='addCommaFloat(this)' onfocus='remComma(this)' STYLE='background:#cccccc' value disabled>&nbsp<select name='sale_curr' size='1' STYLE='background:#cccccc' disabled><%=strCurrOption%></select>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<%=strSupplier%><input type='hidden' name='sup_cd' value>&nbsp&nbsp&nbsp<img class='disabled' alt='検索' SRC='../../images/RetrievalButton2.gif' width='30' height='20' name='retrieve'  onClick='popArrangeName(this);'><img class='disabled' alt='クリア' name='supclear' SRC='../../images/clear2.gif' width='30' height='20' onclick='clearSupplier(this)'>");
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='coefficient' size='5' maxlength='5' datatype='number' class='number2'   onblur='sumQuantity(this);'  onfocus='remComma(this)' value>");   
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<input type='text' name='fst_delivery_date' size='12' maxlength='10' value>");   
newCell = newRow.insertCell();
newCell.insertAdjacentHTML("BeforeEnd","<img class='hotspot' src='../../images/DeletionButton.gif' onclick='delRow(this.parentElement.parentElement.rowIndex);' alt='削除' width='40' height='40'>");                
      
return true;
}没时间了,要下班了,这是以前写的ASP中的一段javascript.可以参照.

解决方案 »

  1.   

    <form id=form1>
    <input type=text>
    </form>
    <input type=button value="add" onclick="form1.innerHTML=form1.innerHTML+'<input type=text size=30 >';savedata();" >
    <input type=hidden value="" id=formdata>
    <script>
    window.onload=getdata;//切换回时读出数据
    window.onbeforeunload=savedata;//换到别的页面之前进行保存
    function getdata(){
      if(formdata.value){form1.innerHTML=formdata.value}
    }
    function savedata(){
      formdata.value=document.all.form1.innerHTML;
    }
      

  2.   

    我忘了我们当时迁移前,必须保存画面数据到数据库,迁移返回时,从数据库LOAD数据.
    不好意思..
      

  3.   

    数据不大的话,在ONUNLOAD事件处理函数里用COOKIE记住数据,等回到该页面时,如
    果有数据,在ONLOAD再动态生成这些行列,并从COOKIE里取出数据,放进这些行列