xml.asp:
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
set req= Server.CreateObject("Microsoft.XMLDOM")
req.async=false
req.load(Request)
if req.documentElement.nodeName="timesheet" then
Response.write("<b>"+req.documentElement.text+"</b><br>")
end if
else
%>
无刷新的!
<Script Language="JavaScript">
function scroller()
{
this.scroll(10,65000);
setTimeout("scroller()",20);
}
scroller();
</Script>
<script language="VBScript">
Function bytes2BSTR(vIn)
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
</script>
<div id="divDisplay"></div>
<input type="text" value="" id="txt">
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "xml.asp", false);
xmlhttp.Send("<timesheet>"+document.all("txt").value+"</timesheet>");
divDisplay.innerHTML=divDisplay.innerHTML+bytes2BSTR(xmlhttp.responseBody);
}
</script>
<%end if%>