如何在vb6中添加元标记



HTMLHeadElement vb6添加元

我有vb6(旧版本(和这个代码Dim helement As HTMLHeadElement我想将此元标记(<meta http-equiv="X-UA-Compatible" content="IE=edge" />(添加到文档-WebBrowser1.document

基于此代码-http://vbcity.com/forums/t/49404.aspx在DocumentComplete子系统中,将文档打印到text2

Dim htDoc As HTMLDocument
Dim htHead As HTMLHeadElement
Dim htMeta As HTMLMetaElement
'<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Set htDoc = WebBrowser1.document
Set htHead = htDoc.getElementsByTagName("HEAD").Item(0)
htDoc.designMode = "on"
'Set htMeta = htDoc.createElement("META")
Set htMeta = htDoc.createElement("META")
'htMeta.httpEquiv = "MSThemeCompatible"
htMeta.httpEquiv = "X-UA-Compatible"
'htMeta.content = "Yes"
htMeta.content = "IE=edge"
Set htMeta = htHead.insertAdjacentElement("afterBegin", htMeta)
htDoc.designMode = "off"
Set htMeta = Nothing
Set htHead = Nothing
Set htDoc = Nothing
'getElementsByTagName("HEAD").Item(0)
'Me.Text2.Text = WebBrowser1.document.body.innerHTML
Me.Text2.Text = WebBrowser1.document.getElementsByTagName("HTML").Item(0).innerHTML

相关内容

  • 没有找到相关文章

最新更新