Gabriele Cappelletto wrote 8 lines
Hello
I would like to find a way to call a function written with pas2js from
html code (do not define onclick from pas2js, but call from html)
example
html
?<input type="button" class="form-control" id="btn3" value="direct mode"
onclick="Btn1Click();"/>
All functions live under the top-level "pas" object, per unit.
So
onclick=pas.YourUnit.Yourfunction()
should do it.
Here YourUnit and YourFunction are of course case sensitive.
If the function is in the main program, then you must write
onclick=pas.program.Yourfunction()
with the identifier "program" in lowercase letters.
You must make sure that rtl.run() has been called when the page loads.
Show quoted text 9 lines
and the Btn1Click function write it with pas2js.
example
function Btn1Click(aEvent: TJSMouseEvent): boolean;
begin
? //?
end;
How can I do?
Just write your function, and refer to it in the above manner.
Michael.