[Pas2js] Call a function from html

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 4 08:23:57 CEST 2019


On Tue, 3 Sep 2019 12:24:21 +0200
Gabriele Cappelletto via Pas2js <pas2js at lists.freepascal.org> wrote:

> 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();"/>  
> 
> and the Btn1Click function write it with pas2js.
> example
> function Btn1Click(aEvent: TJSMouseEvent): boolean;
> begin
> ? //?
> end;
> 
> How can I do?

For example:

var Btn3: TJSHTMLButtonElement;
Btn3:=TJSHTMLButtonElement(document.getElementById('btn3'));
Btn3.onclick:=@Btn1Click;

Mattias


More information about the Pas2js mailing list