解析VBScript中的HTML的responseText [英] Parse a responseText to HTML in VBScript
本文介绍了解析VBScript中的HTML的responseText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从由responseText创建的字符串变量中检索HTML类名称。我需要使用VBscript完成这个。以下是当前代码的示例:
I'm trying to retrieve HTML Class Names from a string variable created by responseText. I need to accomplish this using VBscript. Here is a sample of current code:
set http = createobject("Microsoft.XmlHttp")
http.open "GET","http://www.xxxxxxxxxxx.com/xxx-xxx?xxxxNumber=xxxxx",false
http.send ""
dim html : set html = CreateObject("HTMLFILE")
html.write http.responseText
dim trackdate : trackdate = html.getElementByClassName("tracking-history-date").[0].value
wscript.echo trackdate
我收到以下错误:对象不支持此属性或mehtod: 'getElementByClassName'
I'm receiving the following error: Object doesn't support this property or mehtod: 'getElementByClassName'
推荐答案
我以前遇到过。虽然记录的, getElementsByClassName()
方法似乎没有被实际支持。使用这样的东西可以解决问题:
I've run into this before. Although documented, the getElementsByClassName()
method doesn't seem to actually be supported. Use something like this to work around the issue:
For Each el In html.getElementsByTagName("...")
If el.ClassName = "tracking-history-date" Then
Set trackdate = el
Exit For
End If
Next
这篇关于解析VBScript中的HTML的responseText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文