高手快来,送分小问题

cdxy419 2008-10-24 10:52:25
在VbScript中,如何指定XMLHttp.onreadystatechange的响应函数?

s_XMLHttp.onreadystatechange = new function ("s_XMLHttpStatechange ")

s_XMLHttp.onreadystatechange = function ("s_XMLHttpStatechange ")

s_XMLHttp.onreadystatechange =GetRef("s_XMLHttpStatechange")

Private Sub s_XMLHttp_onreadystatechange()
end Sub

以上测试全没反应
"s_XMLHttpStatechange"是响应函数的名称
在服务器端运行的,原来是同步方式,可以运行,但在网速不好时出现程序被挂起的现象,改用异步方式后,就是不响应onreadystatechange事件,在响应函数的前面,后面,函数里面都有测试点,前后的育反应,就是函数里面的没有反应,根本就不进函数里面
...全文
38 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mnm326 2008-10-24
  • 打赏
  • 举报
回复
帮顶

xml不清楚.关注此贴!
toury 2008-10-24
  • 打赏
  • 举报
回复


s_XMLHttp.onreadystatechange =s_XMLHttp_onreadystatechange

Private function s_XMLHttp_onreadystatechange()
if s_XMLHttp.readyState=4 and s_XMLHttp.status=200 then
s_XMLHttp_onreadystatechange=s_XMLHttp.responseText
end if
end Sub
cdxy419 2008-10-24
  • 打赏
  • 举报
回复
这是全部代码
Dim s_XMLHttp
Function XMLHttpMetHod()
Set s_XMLHttp=Server.CreateObject("Microsoft.XMLHTTP")
s_XMLHttp.Open "Get",requestUrlStr,true
s_XMLHttp.onreadystatechange = s_XMLHttpStatechange
s_XMLHttp.Send
End Function

'****************************************************
'Sub s_XMLHttp_onreadystatechange()
Private Sub s_XMLHttpStatechange()
response.write "aa"
response.End
If IsObject(s_XMLHttp) Then
If s_XMLHttp.readyState = 4 Then
If s_XMLHttp.status = 200 Then
HtmlContent = bytes2BSTR(s_XMLHttp.responseBody)

Select Case MarkMode
Case "FSO"
FSOMetHod
Case "ADOStream"
ADOStreamMetHod
End Select

times=0
Timer= null
Set s_XMLHttp=Nothing
Else
times = times + 1
if times > 3 Then
response.write "IsToNext=1;myStrObj='-------------------------------<br>"&s_XMLHttp.responsetext&"';"
times=0
Timer= null
Set s_XMLHttp=Nothing
response.End
Else
s_XMLHttp.abort()
Set s_XMLHttp=Nothing
if Timer<>null then
clearTimeout Timer
End If
Set Timer = setTimeout("XMLHttpMetHod(""FSO"")",1000)
End If
End If
'Else
'myStrObj='当前对象:'+name+'<br>正在生成静态页面.......'
'showInfo()
End If
End If
End Sub

28,391

社区成员

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

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