下面图老师小编要向大家介绍下用XMLHTTP对象Post表单,看起来复杂实则是简单的,掌握好技巧就OK,喜欢就赶紧收藏起来吧!
【 tulaoshi.com - Web开发 】
试验如下:
提交Form代码(Test.htm):
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)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! :)
来源:http://www.tulaoshi.com/n/20160219/1618319.html
看过《用XMLHTTP对象Post表单》的人还看了以下文章 更多>>