musahi0128 Posted May 7, 2022 Share Posted May 7, 2022 Hello, I'm trying to trigger a function when html button is clicked. The page is embedded inside a GUI. So far I have this code. I expect when I click on the button it trigger the IEEvent_onclick() and show the MsgBox. But when I click on the button it does nothing. #include <GUIConstantsEx.au3> #include <IE.au3> $Form1 = GUICreate("HTML Button Test",600,600,-1,-1) $oIE = _IECreateEmbedded() $oIE_ctrl = GUICtrlCreateObj($oIE,16,16,568,568) _IENavigate($oIE, "about:blank") _IEDocWriteHTML($oIE, "<html><head></head><body><input type=""button"" value=""Click me!"" id=""Button1"" style=""width:128;height:128""/></body></html>") _IEAction($oIE, "refresh") $oMyButton = _IEGetObjById($oIE, "Button1") $oEvtMyButton = ObjEvent($oMyButton, "IEEvent_") GUISetState(@SW_SHOW,$Form1) Func IEEvent_onclick(); I expect this function to be triggered when the "Click me!" button is clicked MsgBox(0, "HTML Button Test", "Hello world! It works!!!") EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Will be cool if this works because I find it easier to create a frontend using html. Thanks! Link to comment Share on other sites More sharing options...
Solution musahi0128 Posted May 7, 2022 Author Solution Share Posted May 7, 2022 Turn out it is working if I comment out the refresh action. My bad😅 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now