日期:2014-05-16 浏览次数:20880 次
<html>
<table>
<form aciton=1.asp method=post name=form1>
<tr>
<td>555.00<input type=text name="name1" value="555.00"/></td>
</tr>
<tr>
<td>666.00<input type=text name="name2" value="666.00"/></td>
</tr>
</form>
</table>
</html>
1.asp
<%
'1.asp页面接收FORM传递来的2个变量值
zhi1=request.form("name1")
zhi2=request.form("name2")
'下面把接收到这2个值存入数据库
'数据库表名:news
'两个字段名称分别是zd1 zd2
set rs=server.createobject("adodb.recordset")
sql="select * from news"
rs.open sql,conn,3,2
rs.addnew
rs("zd1") =zhi1
rs("zd2") = zhi2
rs.update
response.write "保存数据成功!"
%>
<html>
<form action=1.asp method=post name=form1 >
<table>
<tr>
<td>555.00</td>
</tr>
<tr>
<td>666.00</td>
</tr>
</table>
<input type="submit" value="提交" onclick="doSubmit()"/>
</form>
<script>
function doSubmit(){
var f=document.form1;
var td=f.getElementsByTagName('td');alert(td.length)
f.action='1.asp?v1='+td[0].innerHTML+'&v2='+td[1].innerHTML
alert(f.action)
}
</script>
</html>