<%@ Page Language="C#" AutoEventWireup="true" CodeFile="xmbuzhou.aspx.cs" Inherits="详细信息" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title></title>
<script type="text/javascript" language="javascript">
function addFj()
{
var oTb = document.getElementById("tb1");
var oTr = oTb.insertRow(0);
var name = "thefilename"+document.form1.fjCnt.value;
document.form1.fjCnt.value=parseInt(document.form1.fjCnt.value)+1;
oTr.insertCell(0).innerHTML = "<table cellSpacing='0' cellPadding='0' width='100%' align='center'><tr bgColor='#ffffff' align='center'><td><input id='file' name='"+name+"' type=text style='width:400px;'></td><td > <input type=button onclick='return delFj(this)' value='删除'></td></tr></table>"
return false;
}
function delFj(obj)
{
obj.parentElement.parentElement.removeNode(true);
return false;
}
</script><link href="stylesheets/global.css" rel="stylesheet" type="text/css" /><link href="stylesheets/merchant.css" rel="stylesheet" type="text/css" /><link href="sky/Style.css" type="text/css" rel="Stylesheet">
<script type="text/javascript">
function closeBox() {
self.parent.tb_remove();
}
</script>
</head>
<body>
<form id="form1" method="post" runat=server> <table width="500" border="0" align="center" cellspacing="0" style="border: solid 1px #99c2ee; height: 50px;">
<tr>
<td height="29" bgcolor="#F1F1F1" class="pad10_lef sf_t font14" style="text-align: right; background-image: url(cb_banner.jpg); background-repeat: repeat-x;">
<span style="float: left; color: #133A6F;"><strong>项目细分步骤</strong></span> <a href="javascript:void(0);" onclick="closeBox();" style="padding-right: 10px; color: #999999; font-size: 12px;">关闭</a>
</td>
</tr>
<tr>
<td height="200" colspan="2" align="center" valign=top>
<table width="500" align="center"><tr>
<td style="height: 21px" colspan="2">
<table id="tb1" border="0">
</table>
<input type="hidden" name="fjCnt" value="1" />
<br />
<a href="#" onclick="return addFj()" class="bt_mouseout">添加项目步骤</a><asp:Button ID="Button1" class="bt_mouseout" runat="server" Text="保存步骤" OnClick="Button1_Click" /></td>
</tr></table>
</td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title></title>
<script type="text/javascript" language="javascript">
function addFj()
{
var oTb = document.getElementById("tb1");
var oTr = oTb.insertRow(0);
var name = "thefilename"+document.form1.fjCnt.value;
document.form1.fjCnt.value=parseInt(document.form1.fjCnt.value)+1;
oTr.insertCell(0).innerHTML = "<table cellSpacing='0' cellPadding='0' width='100%' align='center'><tr bgColor='#ffffff' align='center'><td><input id='file' name='"+name+"' type=text style='width:400px;'></td><td > <input type=button onclick='return delFj(this)' value='删除'></td></tr></table>"
return false;
}
function delFj(obj)
{
obj.parentElement.parentElement.removeNode(true);
return false;
}
</script><link href="stylesheets/global.css" rel="stylesheet" type="text/css" /><link href="stylesheets/merchant.css" rel="stylesheet" type="text/css" /><link href="sky/Style.css" type="text/css" rel="Stylesheet">
<script type="text/javascript">
function closeBox() {
self.parent.tb_remove();
}
</script>
</head>
<body>
<form id="form1" method="post" runat=server> <table width="500" border="0" align="center" cellspacing="0" style="border: solid 1px #99c2ee; height: 50px;">
<tr>
<td height="29" bgcolor="#F1F1F1" class="pad10_lef sf_t font14" style="text-align: right; background-image: url(cb_banner.jpg); background-repeat: repeat-x;">
<span style="float: left; color: #133A6F;"><strong>项目细分步骤</strong></span> <a href="javascript:void(0);" onclick="closeBox();" style="padding-right: 10px; color: #999999; font-size: 12px;">关闭</a>
</td>
</tr>
<tr>
<td height="200" colspan="2" align="center" valign=top>
<table width="500" align="center"><tr>
<td style="height: 21px" colspan="2">
<table id="tb1" border="0">
</table>
<input type="hidden" name="fjCnt" value="1" />
<br />
<a href="#" onclick="return addFj()" class="bt_mouseout">添加项目步骤</a><asp:Button ID="Button1" class="bt_mouseout" runat="server" Text="保存步骤" OnClick="Button1_Click" /></td>
</tr></table>
</td>
</tr>
</table>
</form>
</body>
</html>
1、将这些text的值放在一个隐藏控件中,提交后,在隐藏控件中获取这些值。
2、第二种就是采用ajax来提交数据。
我的是INPUT控件,也可以直接获取吗?能否详细写一下呢
引用 3 楼 thedolphin 的回复:
asp。net页面提交时是post的,所以得用Request.Forms["控件name"]我要循环读取text里的值一条一条插入到数据库,改怎么弄,我现在后台是这样写的 string title = Request.Form["fjCnt"].ToString();