关于WebBrowser捕获alert弹窗内容的问题
请教个问题,关于WebBrowser捕获alert弹窗内容的。为什么window.alert重写成功了,而且fireEvent返回值为true,但是触发函数onchange没有真正运行呢,调试的时候也看过
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Dim oWindow As HTMLWindow2
Dim oDoc As HTMLDocument
Dim doc
Set oDoc = pDisp.Document
Set oWindow = oDoc.parentWindow
Set m_MyVar = oDoc.createElement("input")
m_MyVar.Type = "Hidden"
m_MyVar.Id = "MyVar"
oDoc.getElementsByTagName("HEAD").Item(0).appendChild m_MyVar
oWindow.execScript "var oldalert=window.alert;window.alert=function myalert(msg){oldalert(msg);MyVar.value=msg;MyVar.fireEvent(""onchange"");};"
End Sub
补充:VB , 网络编程