日期:2014-05-17  浏览次数:20848 次

动态表格保存到数据库的问题
VBScript code
 <table width="99%" border="1" align="center" cellpadding="4" cellspacing="1" class="toptable grid" id="SignFrame">            
<tr id="trHeader"> 
      <td width="30" align="center">序号 </td> 
      <td width="28" align="center">数量 </td>
      <td width="33" align="center">单价 </td>
      <td width="35" align="center">金额 </td>
      <td width="37" align="center"> </td> 
    </tr>
</table>
<div> <br> <br>
    <input name="Submit" type="button" class="hand" onClick="AddSignRow()" value="添加一行" />
        <input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    <input name="button" type="submit" class="hand" id="button" value=" 确认提交 "> <br>
</div>
</body>
</HTML>
<%
Dim count1,rsClass1,sqlClass1
set rsClass1=server.createobject("adodb.recordset")
sqlClass1="select * from cgdlei Order By lei asc"
rsClass1.open sqlClass1,conn,1,1
%>
<script language="javascript">// Example: obj = findObj("image1"); 
var arr1 = [], arr2 = [];
function findObj(theObj, theDoc){  var p, i, foundObj;    if(!theDoc) theDoc = document;  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)  {    theDoc = parent.frames[theObj.substring(p+1)].document;    theObjtheObj = theObj.substring(0,p);  }  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];  for (i=0; !foundObj && i < theDoc.forms.length; i++)    foundObj = theDoc.forms[i][theObj];  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)    foundObj = findObj(theObj,theDoc.layers[i].document);  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);    return foundObj;} 
//添加一个填写行 
function AddSignRow(){ //读取最后一行的行号,存放在txtTRLastIndex文本框中   
var txtTRLastIndex = findObj("txtTRLastIndex",document); 
var rowID = parseInt(txtTRLastIndex.value); 
   
var signFrame = findObj("SignFrame",document); 
//添加行 
var newTR = signFrame.insertRow(signFrame.rows.length); 
newTR.id = "SignItem" + rowID; 
   
//添加列:序号 
var newNameTD=newTR.insertCell(0); 
//添加列内容 
newNameTD.innerHTML = newTR.rowIndex.toString(); 

  //添加列:数量 
var newCompanyTD=newTR.insertCell(1); 
//添加列内容 
newCompanyTD.innerHTML = " <input onFocus='this.select()' name='sl" + rowID + "' type='text' class='txt24px' id='sl" + rowID + &