用XMLHTTP对象Post表单 |
| 作者:佚名 来源:网页教学网 更新:2005-7-26 0:34:03 错误报告 我要投稿 |
|
试验如下: 提交Form代码(Test.htm):
<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> <script language=javascript> function Test() { strA = "submit1=Submit&text1=scsdfsd"; file://Looks like QueryString,But there's no "?" here! var oReq = new ActiveXObject("MSXML2.XMLHTTP"); oReq.open("POST","http://ServerName/VDir/TstResult.asp",false); oReq.setRequestHeader("Content-Length",strA.length); oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded"); oReq.send(strA); txt1.document.write(oReq.responseText); } </script> </HEAD> <BODY> <INPUT type=button value="go!" onclick="Test()"><br> <IFRAME style="width:95%;height=85%;" name=txt1></IFRAME> </BODY> </HTML>
这是接受Form数据的ASP,很简单。 <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> </HEAD> <BODY> <TABLE border="1" cellpadding=0 cellspacing=0> <%For Each Key In Request.Form%> <TR> <TD><%=Key%></TD> <TD><%=Request.Form(Key)%></TD> </TR> <%Next%> </TABLE> </BODY> </HTML>
Enjoy it! :) |
|
| 文章录入:skyuu 责任编辑:skyuu |
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |