这个问题听起来很愚蠢,但是当我使用函数 GetElementsByTagname("frame") 时,它只返回 3 作为长度而不是我预期的 5?
这是网页的 HTML,我计算了标记名“框架”幻影的 5 倍,但是当我在 VBA 中询问长度时,我得到 3...
我的观察:
1)可以看到3是主框架的数量(top_navigation、contentframe、dummyframe)
2) 如果我尝试通过 getelementbyname 访问其中一个大型机,它可以工作,但如果我尝试访问 contentframe 的子框架(leftnavigation 或 postfachcontent),它就不起作用(检测到 0 个项目)
这是我的代码:
Dim Frame As IHTMLElementCollection
Set Frame = IEDoc.getElementsByName("contentframe") ' this works and returns 1 item
MsgBox Frame.Length
Set Frame = IEDoc.getElementsByName("postfachcontent")
MsgBox Frame.Length ' this returns 0 item
Dim Collection As IHTMLElementCollection
Set Collection = IEDoc.getElementsByTagName("frame")
MsgBox Collection.Length ' this returns 3 and I expected 5...