码迷,mamicode.com
首页 > Web开发 > 详细

vb6 webbrowser 事件捕获

时间:2014-08-26 13:36:46      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   io   for   ar   div   cti   

Private WithEvents htmlDocument As htmlDocument
Private WithEvents btnCompute As MSHTML.HTMLButtonElement
Private WithEvents txtNum1 As MSHTML.HTMLInputTextElement
Private WithEvents txtNum2 As MSHTML.HTMLInputTextElement
Private WithEvents txtResult As MSHTML.HTMLInputTextElement

Private Function btnCompute_onclick() As Boolean
    On Error GoTo ErrHandler:
    txtResult.Value = CDbl(txtNum1.Value) + CDbl(txtNum2.Value)
    Exit Function
ErrHandler:
    MsgBox Err.Description
End Function

Private Sub Command1_Click()
    Text1.Visible = Not Text1.Visible
End Sub

Private Sub Form_Load()
    WebBrowser1.Navigate "about:blank"
    Do While WebBrowser1.Busy Or WebBrowser1.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
    WebBrowser1.Document.write Text1.Text
    Do While WebBrowser1.Busy Or WebBrowser1.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
    
    Set htmlDocument = WebBrowser1.Document
    Set btnCompute = htmlDocument.getElementById("btnCompute")
    Set txtNum1 = htmlDocument.getElementById("txtNum1")
    Set txtNum2 = htmlDocument.getElementById("txtNum2")
    Set txtResult = htmlDocument.getElementById("txtResult")

End Sub

Private Function htmlDocument_onclick() As Boolean
    Debug.Print "触发了元素" & htmlDocument.parentWindow.event.srcElement.id & "" & htmlDocument.parentWindow.event.Type & "事件"
End Function

 

vb6 webbrowser 事件捕获

标签:des   style   blog   color   io   for   ar   div   cti   

原文地址:http://www.cnblogs.com/nanfei/p/3937047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!