[Pas2js] Call a function from html

Michael Van Canneyt michael at freepascal.org
Wed Sep 4 08:26:42 CEST 2019


OP is not subscribed to the list. In your replies, put him in CC.

As I understood the question, it is not how can I set the event in pas2js 
but how can I refer to a function from HTML.

Michael.

On Wed, 4 Sep 2019, Mattias Gaertner via Pas2js wrote:

> 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
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list