我们知道document对象是window对象的一个子对象,所以我们可以通过 document.getElementById(“iframe ID”).contentWindow.document来获取iframe的 document对象,相当于contentDocument属性。
用vb测试
Dim doc As HTMLDocument
Set doc = WebBrowser1.document
Dim t As IHTMLElement
Dim a As HTMLDocument
Set a = doc.getElementById("ueditor_0").contentWindow.document
这些语句是没有问题的
但在狐表中使用这个方法
'Dim htmFrame As System.Windows.Forms.Htmldocument= web.Document.GetElementById("ueditor_0").contentwindow.document 'ueditor_0 指向一个iframe
未找到类型“HtmlElement”的公共成员“contentWindow”。