| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 629 人关注过本帖
标题:表格动态添加行后里面的值怎么传
只看楼主 加入收藏
robin_fan
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2009-2-24
结帖率:60%
收藏
 问题点数:0 回复次数:1 
表格动态添加行后里面的值怎么传
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/cc.asp" -->
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject (")
Recordset1_cmd.ActiveConnection = MM_cc_STRING
Recordset1_ = "SELECT workthingsname FROM workthings_type ORDER BY autoid ASC"
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

<script LANGUAGE="JavaScript">
function newRow()
{
   
     var row= tbl.insertRow(-1);  //添加行
         row.height="28";  //设置行高
     var cell1=    row.insertCell(0); //添加列
     var cell2=    row.insertCell(1);  //添加列
     var cell3=    row.insertCell(2);
     var cell4=    row.insertCell(3);
     var cell5=    row.insertCell(4);  
     cell1.innerHTML="<center>"+"请选择"+"</center>";
     cell2.innerHTML="<center>"+"<select id='select1'>"+" <% While (NOT Recordset1.EOF) %><option value='<%=(Recordset1.Fields.Item("workthingsname").Value)%>'><%=(Recordset1.Fields.Item("workthingsname").Value)%>"+"</option><%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>"+"</select>"+"</center>";
   

     cell3.innerHTML="<center>"+"<input name='textfield' type='text' id='textfield' size='5'/>"+"</center>";
    cell4.innerHTML="&nbsp;";
   cell5.innerHTML="&nbsp;";
}
</script>

</head>

<body>
<form name="applicantTable" action="sectionCheckPage.asp" method="post">
<table width="840" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" id="tbl" align="center">
  <!--DWLayoutTable-->
  <tr>
    <td height="43" colspan="5" align="center" valign="middle"><span class="STYLE6">办公用品申请单</span></td>
  </tr>
  <tr>
    <td width="110" height="30" align="center" valign="middle"><span class="STYLE5">申请人姓名</span></td>
    <td colspan="2" align="center" valign="middle"><span class="STYLE5">申请物品</span></td>
    <td width="163" align="center" valign="middle"><span class="STYLE5">所属部门</span></td>
    <td width="136" align="center" valign="middle"><span class="STYLE5">申请时间</span></td>
  </tr>
  <tr>
    <td height="28" align="center" valign="middle"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td width="326" align="center" valign="middle"><span class="STYLE5">品种
        <label></label>
    </span>      <span class="STYLE8">
    <label></label>
    </span>    <label></label></td>
    <td width="105" align="center" valign="middle"><span class="STYLE5">数量</span></td>
    <td align="center" valign="middle"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td align="center" valign="middle"><!--DWLayoutEmptyCell-->&nbsp;</td>
  </tr>
  <tr>
    <td height="28" align="center" valign="middle">请选择</td>
    <td align="center" valign="middle"><label>
      <select name="select1" id="select1">
        <%
While (NOT Recordset1.EOF)
%>
        <option value="<%=(Recordset1.Fields.Item("workthingsname").Value)%>"><%=(Recordset1.Fields.Item("workthingsname").Value)%></option>
        <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
      </select>
    </label></td>
    <td align="center" valign="middle"><label>
      <input name="textfield1" type="text" id="textfield1" size="5" align="middle" />
    </label></td>
    <td colspan="2" align="center" valign="middle">添加请按<strong>→</strong>
      <label>
      <input type="button" name="button" id="button" value="添加"  onclick="newRow()"/>
    </label></td>
  </tr>
</table>
<p></p>
<div align="center">
  <input type="submit" value="提交" />
  &nbsp;
  <input type="reset" value="作废" />
</div>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
请问新添加的行里的内容如何传值到其他页面?
搜索更多相关主题的帖子: 表格 动态 
2010-07-22 09:01
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
建议用 Jquery + AJAX 传送
var InputVal = "";

$("#tbl").find("tr").each(function(i){
    if(i>0)
    {
        $(this).find("input").each(function(j){
           InputVal += $(this).val()+",";
        });
        InputVal = InputVal.slice(0,-1);//去除最后一个 逗号
        InputVal += InputVal +"|";//每行数据间隔
    }
});
    InputVal = InputVal.slice(0,-1);// 去除最后一个“ |”

$.ajax({
   type: "POST",
   url: "sectionCheckPage.asp",
   data: "name=John&location=Boston",//这里加上你自己的传送数据
   success: function(msg){
     alert( "Data Saved: " + msg );//提示处理信息
   }
});

生活的理想,就是为了理想的生活。
2010-07-22 14:37
快速回复:表格动态添加行后里面的值怎么传
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041324 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved