一段调用webserviece的代码老是出错,请各位大侠帮忙!

lxhvc 2004-06-19 05:44:53
case else
index=0
'建立XMLDOM对象用Load方法呼叫Web Service,将结果装入XML DOM对象
div1.innerHtml =""
Set docSubmit = CreateObject("MSXML2.DOMDocument")
docSubmit.async = False
docSubmit.load "http://msft-chen/ASPTips2/CH1/SearchTitles.asmx/doSearch?keyword=" & Trim(Text1.value)
'因为使用Httpget方式,URL会被encode所以要再传回来,这部分比较麻烦
docSubmit.loadXML replace(replace(docSubmit.xml,"<","<"),">",">")
'msgbox docSubmit.xml

'重组DHTML效果字符串
set nodeList=docSubmit.documentElement.getElementsByTagname("Table")
for each node in nodeList
s=s & "<div style=""WIDTH:490px;"" class=""gotTitle"" onmouseover=""javascript:this.style.backgroundColor='lightblue'"" onmouseout=""javascript:this.style.backgroundColor='white'"" onclick=""gotTitle_onclick""> " & node.selectSingleNode("title").text & "</div>"
next
div1.innerHtml=s
div1.style.visibility="visible"
...全文
79 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
netflymice 2004-07-10
  • 打赏
  • 举报
回复
怎么没有人回答啊!
CsdnRob 2004-07-02
  • 打赏
  • 举报
回复
自己先顶一下
lxhvc 2004-06-19
  • 打赏
  • 举报
回复
自己先顶一下
lxhvc 2004-06-19
  • 打赏
  • 举报
回复
这个是全部代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE></TITLE>
<META content="Microsoft Visual Studio 7.0" name="GENERATOR">
<SCRIPT language="vbscript" id="clientEventHandlersVBS">
<!--
index=0 '选取位置

'定位div

Sub window_onload
div1.style.left=text1.offsetLeft
div1.style.top=text1.offsetTop+24
div1.style.width=text1.offsetWidth
End Sub

'当使用者输入查询字符串,
Sub Text1_onkeyup
'msgbox window.event.keyCode
select case window.event.keyCode
case 13 '按Enter
div1.style.visibility="hidden"
case 40,39 '按下或左
if index < div1.childNodes.length then
index=index+1
end if
for i=1 to div1.childNodes.length
if i=index then
text1.value=mid(div1.childNodes(index-1).innerText,2)
div1.childNodes(index-1).style.backgroundColor="lightblue"
else
div1.childNodes(i-1).style.backgroundColor="white"
end if
next
case 38,37
if index>1 then
index=index-1
end if
for i=1 to div1.childNodes.length
if i=index then
text1.value=mid(div1.childNodes(index-1).innerText,2)
div1.childNodes(index-1).style.backgroundColor="lightblue"
else
div1.childNodes(i-1).style.backgroundColor="white"
end if
next
case else
index=0
'建立XMLDOM对象用Load方法呼叫Web Service,将结果装入XML DOM对象
div1.innerHtml =""
Set docSubmit = CreateObject("MSXML2.DOMDocument")
docSubmit.async = False
docSubmit.load "http://msft-chen/ASPTips2/CH1/SearchTitles.asmx/doSearch?keyword=" & Trim(Text1.value)
'因为使用Httpget方式,URL会被encode所以要再传回来,这部分比较麻烦
docSubmit.loadXML replace(replace(docSubmit.xml,"<","<"),">",">")
'msgbox docSubmit.xml

'重组DHTML效果字符串
set nodeList=docSubmit.documentElement.getElementsByTagname("Table")
for each node in nodeList
s=s & "<div style=""WIDTH:490px;"" class=""gotTitle"" onmouseover=""javascript:this.style.backgroundColor='lightblue'"" onmouseout=""javascript:this.style.backgroundColor='white'"" onclick=""gotTitle_onclick""> " & node.selectSingleNode("title").text & "</div>"
next
div1.innerHtml=s
div1.style.visibility="visible"
end select
End Sub

Sub gotTitle_onclick
if window.event.srcElement.className="gotTitle" then
text1.value=mid(window.event.srcElement.innerText,2)
div1.style.visibility="hidden"
end if
End Sub

Sub Text1_onblur
'div1.style.visibility="hidden"
End Sub
-->
</SCRIPT>
<style>
.list{
BORDER-RIGHT:black 1px solid;
BORDER-TOP:black 1px outset;
BORDER-BOTTOM:black 1px solid;
BORDER-LEFT:black 1px outset;
FONT-SIZE:x-small;
VISIBILITY:hidden;
WIDTH:490px;
HEIGHT:20px;
CURSOR:default;
POSITION:absolute; }
</style>
</HEAD>
<BODY>
<P><FONT face="宋体">搜索书籍:</FONT> <INPUT id="Text1" type="text" name="Text1" size="78"> </P>
<div id="div1" class="list"></div>
<P><FONT face="宋体"></FONT></P>
</BODY>
</HTML>
lxhvc 2004-06-19
  • 打赏
  • 举报
回复
运行时提示set nodeList=docSubmit.documentElement.getElementsByTagname("Table")
有错误!提示:缺少‘docSubmit.documentElement’对象!

28,390

社区成员

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

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