Article ID: 185140
Article Last Modified on 5/11/2006
Option Explicit Private Sub Command1_Click() Dim str As String ' Insert some HTML comments str = "<!-- This is a comment -->" WebBrowser1.Document.body.insertAdjacentHTML "BeforeEnd", str End Sub Private Sub Form_Load() WebBrowser1.Navigate "http://example.microsoft.com/WebPage.htm" End Sub
Debug.Print WebBrowser1.Document.body.outerHTML
Option Explicit
Private Sub Command1_Click()
Dim str As String
' Insert some hidden HTML before the comment
str = "<span style='display:none'>h</span>" & _
"<!-- This is a comment -->"
WebBrowser1.Document.body.insertAdjacentHTML "BeforeEnd", str
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://example.microsoft.com/WebPage.htm"
End Sub
When you execute the statement in step 4 above, the HTML comment now
appears in the document.
Additional query words: insertAdjacentHTML pasteHTML outerHTML kbWebBrowser
Keywords: kbdhtml kbfaq kbpending kbprb kbwebbrowser KB185140