用XMLHTTP对象Post表单
试验如下:
提交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! :)