代码如下:
假设已经建立XMLHTTP对象代码(这里不在重复)
function getInfo() {
var phone = document.getElementById("username").value;
var url = "daimajiance.asp?user=" + escape(phone);//daimajiance.asp为需要调用其他网站数据的核心ASP文件!
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send(null);
}
function updatePage()
{
if (request.readystate == 4)
if (request.status == 200)
{
var response = unescape(request.responseText);
response=response.toString();
response=response.split("|");
document.getElementById("sp").innerText =response[1];//大单买量
document.getElementById("zd").innerText =response[2];//大单卖量
}
daimajiance.asp源文件:
Dim Url,msg,start,over,gc,zf,jg,zdf,hsl,lbi,npan,wpan
Url="http://bill.finance.
msg = getHTTPPage(Url)
‘取得主买量
start=Instr(msg,"主买量") + 40
over=Instr(msg,"主卖量")-10
gc=mid(msg,start,over-start)
For i=1 To Len(gc)
zf=Mid(gc,i,1)
If IsNumeric(zf) Or zf="." Then
jg=jg&zf
End if
Next
’取得主卖量
start=InStr(msg,"主卖量")+40
over=InStr(msg,"中性量")-10
gc=Mid(msg,start,over-start)
For i=1 To Len(gc)
zf=Mid(gc,i,1)
If IsNumeric(zf) Or zf="." Or zf="-"
Then
zdf=zdf&zf
End if
Next
response.write(escape(jg&"|"&zdf))
然后置两个显示标签:
<span id="sp">大单买量</span>
<span id="zd">大单卖量</span>