摘要:[VB6]怎麼才能讓webbrowser1中的網頁的原代碼自動在text1.text中顯示呀?
方法1:
Private Sub Combo1_Change()
Timer1.Enabled = true
End Sub
Private Sub Timer1_Timer()
Dim doc, objhtml As Object
Dim i As Integer
Dim strhtml As String
If Not WebBrowser1.Busy Then
Set doc = WebBrowser1.Document
i = 0
Set objhtml = doc.body.createtextrange()
If Not IsNull(objhtml) Then
Text1.Text = objhtml.htmltext
End If
Timer1.Enabled = False
End If
End Sub
方法2:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Text1 = WebBrowser1.Document.documentElement.outerhtml
End Sub