天天看點

擷取VB裡 webbrowser 中的按鈕事件

引用microsoft  html  object  library 

<dl><dd></dd></dl>

private withevents m_odoc as htmldocument

dim oevent as ceventobj

private sub command1_click()

end sub

private sub form_load()

webbrowser1.navigate "http://localhost:82/index.asp"

private function m_odoc_onclick() as boolean

set oevent = m_odoc.parentwindow.event

if oevent.srcelement.id = "login" then

form2.show

form2.webbrowser1.navigate "http://localhost:82/receive.asp"

end if

end function

private sub webbrowser1_documentcomplete(byval pdisp as object, url as variant)

set m_odoc = pdisp.document

index.asp

&lt;form&gt;

&lt;input type='button' value="登陸" id="login"&gt;&lt;/input&gt;

&lt;/form&gt;