function PostData(url,Body)
{
var xml = new ActiveXObject("Microsoft.XMLHTTP");
xml.open("POST",url,false);
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xml.setRequestHeader("Content-Length",escape(Body).length);
xml.send(escape(Body));
return unescape(xml.responseText);
}
PostData("http://www.test.com","username=me&password=123")
url="http://www.test.com?username=me&password=123"
set oSend=createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",url,false)
oSend.send()
if err.number<>0 then
Response.write err.description
Response.End()
end if
getSourceCode = oSend.responseBody
客户端JS:
function PostData(url,Body)
{
var xml = new ActiveXObject("Microsoft.XMLHTTP");
xml.open("POST",url,false);
xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xml.setRequestHeader("Content-Length",escape(Body).length);
xml.send(escape(Body));
return unescape(xml.responseText);
}
server2=cstr(request.servervariables("server_name"))
if mid(server1,8,len(server2))<>server2 then
response.end()
end if
keyword=vb_unescape(request("keyword"))
keyword=replace(keyword,"'","''")
set conn=server.createobject("ADODB.CONNECTION")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../#cn8.asp")
conn.open connstr
str=""
set rs=conn.execute("select top 25 * from mp3 where mp3name like '%"&keyword&"%' order by len(mp3name)")
if rs.eof and rs.bof then
response.Write("没有找到")
else
i=1
for i=1 to 25
if rs.eof then exit for
str=str&i&".<span style=""cursor:hand"" onClick=""opener.mkList('"&rs("mp3url")&"','"&rs("mp3name")&"');"">"&rs("mp3name")&"</span><a href='"&rs("mp3url")&"'>下载</a><br>"
rs.movenext
next
end if
str=vb_escape(str)
response.Write(str)
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<script language="javascript" runat="server">
function vb_escape(str)
{
return escape(str);
}
function vb_unescape(str)
{
return unescape(str);
}
</script>