访问框架中的文档的代码 Dim pFramesCol As IHTMLFramesCollection2 Dim pDisp As Object Dim IWindow2 As IHTMLWindow2 Dim i As Integer Dim varIndex As Variant Dim frameDoc As IHTMLDocument2 Set pFramesCol = doc.frames If Not pFramesCol Is Nothing Then For i = 0 To pFramesCol.length - 1 varIndex = i Set pDisp = pFramesCol.Item(varIndex) Set IWindow2 = pDisp If Not IWindow2 Is Nothing Then If Not IWindow2.Document Is Nothing Then Set frameDoc = IWindow2.Document End If End If Next i End If 注意跨域访问框架会有拒绝访问错误。
Dim pFramesCol As IHTMLFramesCollection2
Dim pDisp As Object
Dim IWindow2 As IHTMLWindow2
Dim i As Integer
Dim varIndex As Variant
Dim frameDoc As IHTMLDocument2
Set pFramesCol = doc.frames
If Not pFramesCol Is Nothing Then
For i = 0 To pFramesCol.length - 1
varIndex = i
Set pDisp = pFramesCol.Item(varIndex)
Set IWindow2 = pDisp
If Not IWindow2 Is Nothing Then
If Not IWindow2.Document Is Nothing Then
Set frameDoc = IWindow2.Document
End If
End If
Next i
End If
注意跨域访问框架会有拒绝访问错误。
邮箱:[email protected]
http://freehost08.websamba.com/hzhzhz/xuexi/!DHTML_HTML_CSS.chm