比如说,我有一个Html网页源码如下:<html>
<frameset rows="20%,20%,20%,20%,20%">
<frame src="http://www.aaa.com">
<frame src="http://www.bbb.com">
<frame src="http://www.cccc.com">
<frame src="http://www.dddd.com">
<frame src="http://www.eeeee.com">
</frameset>
</html>这个网页有五个框架,分别引入了各自的网页.我想获取其中某个框架的源码,怎么操作呢?我可以获取到框架的数量:webbrowser1.document.frames.length 这个是获取其数量如何取其中一个框架中的网页源码呢?懂的高手们帮帮小弟吧
<frameset rows="20%,20%,20%,20%,20%">
<frame src="http://www.aaa.com">
<frame src="http://www.bbb.com">
<frame src="http://www.cccc.com">
<frame src="http://www.dddd.com">
<frame src="http://www.eeeee.com">
</frameset>
</html>这个网页有五个框架,分别引入了各自的网页.我想获取其中某个框架的源码,怎么操作呢?我可以获取到框架的数量:webbrowser1.document.frames.length 这个是获取其数量如何取其中一个框架中的网页源码呢?懂的高手们帮帮小弟吧
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Me.Print test(WebBrowser1)
End SubPrivate Function test(wb1 As WebBrowser) As String
Dim vDoc As Object, vTag As Object
Dim i%, strTagName$, strTagName2$, strTagType$, strTagValue$, strLine$
Set vDoc = wb1.Document
For i = 0 To vDoc.All.Length - 1 '检测所有标签
strTagName = vDoc.All(i).tagName
strTagName2 = UCase(strTagName)
If strTagName2 = "INPUT" Or strTagName2 = "TEXTAREA" Or strTagName2 = "SELECT" Then
strLine = strLine & i + 1 & "*" & strTagName & "*" & _
"Name:" & vDoc.All(i).Name & "*" & _
"Id:" & vDoc.All(i).Id & "*" & _
"Type:" & vDoc.All(i).Type & "*" & _
"Value:" & vDoc.All(i).Value & "*" & vbCrLf
ElseIf strTagName2 = "A" Then
strLine = strLine & i + 1 & "*" & strTagName & "*" & _
"href:" & vDoc.All(i).href & "*" & _
"OnClick:" & vDoc.All(i).OnClick & "*" & vbCrLf
Else
strLine = strLine & i + 1 & "*" & strTagName & vbCrLf
End If
Next i
test = strLine
End Function
webbrowser1.Document.getElementById("mainFrame").contentWindow
http://topic.csdn.net/u/20100826/21/57113d41-6a6f-4b97-b20d-70bf26f55b7e.html
http://tieba.baidu.com/p/873865493