#2
zs李四2017-01-24 10:13
|
这是以前VB的方法,不知道怎么用啊。
单击command1获得框架及其元素方法1
Private Sub Command1_Click()
Dim Doc2 As HTMLDocument
Dim Web2 As WebBrowser_V1
Set Web2 = GetFrameIframeLikeUrl(WebBrowser1.Document, "*baidu.com*")
If Not Web2 Is Nothing Then
Set Doc2 = Web2.Document
Doc2.getElementById("JZGXXJLXX_addBtn").Click,单击了网页框架中的按钮
End If
End Sub
Function GetFrameIframeLikeUrl(Vdoc As HTMLDocument, LikeUrl As String) As WebBrowser_V1
Dim Vtag, Tname As String, FrameWeb As WebBrowser_V1
For Each Vtag In Vdoc.All
Tname = Vtag.tagName
If Tname = "IFRAME" Or Tname = "FRAME" Then
Set FrameWeb = Vtag
If FrameWeb.LocationURL Like LikeUrl Then
Set GetFrameIframeLikeUrl = FrameWeb
Exit Function
End If
End If
Next
End Function
不知在中怎么实现。
[此贴子已经被作者于2016-12-23 11:04编辑过]