Call a function from html
lazarus / 76-Pas2JS
----------------------------------------------------------------------
cappe · 2019-09-03 10:11
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
and the Btn1Click function write it with pas2js.
example
function Btn1Click(aEvent: TJSMouseEvent): boolean;
begin
//
end;
How can I do?
Added:
I would like to know how to do it because the Btn1Click function can
be reached from outside the js file of pas2js.
----------------------------------------------------------------------
Thaddy · 2019-09-03 11:46
???? As long as rtl.js can be found you should not have no problems at
all? Can you be more specific??
----------------------------------------------------------------------
cappe · 2019-09-03 12:06
I probably miss some pas2js programming base
in pas2js I create a function like this:
function Btn1Click(aEvent: TJSMouseEvent): boolean;
begin
//
end;
I compile the project and I return project1.js as correct.
Now the call to this works I don't want to do it from the pas2js
project (like button1.onclick := @Btn1Click;), but from the html file
As an example
The problem that the html file does not find me Btn1Click () ;. So the
question is how can I make Btn1Click to be reachable from the html
file (so abroad for the pas2js project)?