记录?是想看源代码吗?<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
<script>
var oDiv
var xh
function getXML()
{
oDiv = document.all.m
oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("post",a.value,true)
xh.send()
//alert (xh.responseText);}function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{ oDiv.innerHTML = "完成"
}
else
{
oDiv.innerHTML = "抱歉,装载数据失败。原因:" + xh.statusText
}
}
}
</script>
<body>
xmlhttp异步的例子:
URL:<input name=a value="http://www.sdxnw.gov.cn/qxxn_yb_lists.asp?qxxn=12" style="width:600px">
<input onclick="getXML()" type="button" value="得到源代码">
<input onclick="if(xh && xh.responseText) {alert(xh.responseText);oDiv.innerHTML=xh.responseText}" type="button" value="显示源代码">
<div id=m></div> </BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
<script>
var oDiv
var xh
function getXML()
{
oDiv = document.all.m
oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("post",a.value,true)
xh.send()
//alert (xh.responseText);}function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{ oDiv.innerHTML = "完成"
}
else
{
oDiv.innerHTML = "抱歉,装载数据失败。原因:" + xh.statusText
}
}
}
</script>
<body>
xmlhttp异步的例子:
URL:<input name=a value="http://www.sdxnw.gov.cn/qxxn_yb_lists.asp?qxxn=12" style="width:600px">
<input onclick="getXML()" type="button" value="得到源代码">
<input onclick="if(xh && xh.responseText) {alert(xh.responseText);oDiv.innerHTML=xh.responseText}" type="button" value="显示源代码">
<div id=m></div> </BODY>
</HTML>
function getonlinenum()
{
var objXMLHTTP=new ActiveXObject("MICROSOFT.XMLHTTP");
objXMLHTTP.open("GET","http://www.sdxnw.gov.cn/qxxn_yb_lists.asp?qxxn=12",false);
objXMLHTTP.send("");
var strReturn=objXMLHTTP.ResponseBody;
online_num.innerHTML=bytes2BSTR(strReturn);
}
</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>
</head>
<body onload="getonlinenum()">
<span id=online_num></span>
教程很多,看了就明白了