xmlhttp问题,

潜水的鱼 2004-01-31 03:01:30
<%
Response.Charset = "gb2312"

set xml=server.createobject("microsoft.xmlhttp")
xml.open "get","http://www.online.sh.cn",false
xml.setrequestheader "content-type","application/x-www-form-urlencoded"
xml.send

response.write"<xmp>"
response.write xml.responsexml
response.write"</xmp>"
set xml=nothing
%>
----------显示----------------------------------------------------
<font face="宋体" size=2>
<p>答复对象</font> <font face="宋体" size=2 > 错误 'ASP 0185 : 80020003'</font>
<p>
<font face="宋体" size=2>缺少默认属性</font>
<p>
<font face="宋体" size=2>/temp.asp</font><font face="宋体" size=2>,行0</font>
<p>
<font face="宋体" size=2>找不到对象的默认属性。
</font>


是什么原因????
...全文
80 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yohoo 2004-02-03
  • 打赏
  • 举报
回复
gz
东南西北风 2004-02-03
  • 打赏
  • 举报
回复
???
看不懂啊.
51windows 2004-02-02
  • 打赏
  • 举报
回复
<%
Function URLEncoding(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function

Function bytes2BSTR(vIn)
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

set xml=server.createobject("microsoft.xmlhttp")
xml.open "get","http://www.google.com",false
xml.send

'response.write"<xmp>"
response.write bytes2BSTR(xml.responseBody)
'response.write"</xmp>"
set xml=nothing
%>
51windows 2004-02-02
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmproreadystaterequest.asp

readyState Property (IXMLHTTPRequest)
Represents the state of the request.

Remarks
Variant. The property is read-only. It represents the state of the request as an I4 (4-byte integer). The following values are defined.


0 (UNINITIALIZED) The object has been created, but not initialized (open method has not been called).
(1) LOADING The object has been created, but the send method has not been called.
(2) LOADED The send method has been called and the status and headers are available, but the response is not yet available.
(3) INTERACTIVE Some data has been received. You can call responseBody and responseText to get the current partial results.
(4) COMPLETED All the data has been received, and the complete data is available in responseBody and responseText.


This property returns a 4-byte integer.
潜水的鱼 2004-02-02
  • 打赏
  • 举报
回复
up
潜水的鱼 2004-02-01
  • 打赏
  • 举报
回复
to:.楼上,

Http.readystate<>4

是判断什么不等于4.?
DeltaCat 2004-02-01
  • 打赏
  • 举报
回复
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,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
潜水的鱼 2004-02-01
  • 打赏
  • 举报
回复
up
潜水的鱼 2004-01-31
  • 打赏
  • 举报
回复
to: net_lover(孟子E章)

你的方法我试过,不能显示汉字有汉字的地方是"??"

to: xieyj(Free Fish)

你的显示::正在装载栏目数据,请稍侯.......

就卡住了
孟子E章 2004-01-31
  • 打赏
  • 举报
回复
<%
set xml=server.createobject("microsoft.xmlhttp")
xml.open "get","http://www.online.sh.cn",false
xml.send

response.write"<xmp>"
response.write xml.responseText
response.write"</xmp>"
set xml=nothing
%>
xieyj 2004-01-31
  • 打赏
  • 举报
回复
试这种方法
<script>
var oDiv //添加用的节点
var nP //DIV的 padding-left
var xh //xmlhttp
function getXML()
{
oDiv = document.all.m
oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("GET",a.value,true)
xh.send()
}

function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{

oDiv.innerHTML = "完成"
}
else
{
oDiv.innerHTML = "抱歉,装载数据失败。原因:" + xh.statusText
}
}
}
</script>
URL:<input name=a value="http://www.microsoft.com">
<input onclick="getXML()" type="button" value="get HTML">
<input onclick="if(xh && xh.responseText) oDiv.innerHTML=xh.responseText" type="button" value="output">
<div id=m></div>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧