SEGNA Posted February 27, 2023 Share Posted February 27, 2023 Hi, I am writing a simple alert function in afterscript inside unihtmlframe. And when I try to call it at runtime with a button on the form, I get the undefined warning. It works when I write it inside the html string. But the field I need to use is aftersciprt, I have a different code running there. UniHTMLFrame AfterScript; function myFunction() { alert("Alert..."); } Button Click Code; procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('myFunction()'); end; How can i solve the problem? Thank you. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 27, 2023 Share Posted February 27, 2023 Hello, You can try this: window.myFunction = function() { alert("Alert..."); } Quote Link to comment Share on other sites More sharing options...
SEGNA Posted February 27, 2023 Author Share Posted February 27, 2023 Hi, Problem is solved. Thank you for your support. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.