[Gambas-user] Placing a Java script at the bottom of WebForm

Benoit Minisini benoit.minisini at gambas-basic.org
Mon Jun 27 22:12:38 CEST 2022

Le 27/06/2022 à 11:29, Safiur Rahman a écrit :
> Hi
> I need to put javascript at bottom because it references some web 
> controls. The controls need to be loaded before executing the code. If 
> it's in the HEAD section, the script will be parsed before any HTML or 
> CSS elements are loaded. Isn't it?

The logic of 'gb.web.gui' is based on imbricated controls. So all the 
javascript is normally associated with the implementation of controls, 
or sent in the response of an event.

In your case, if the javascript code is associated with a specific 
control, you can use the Render event of that control that is raised 
after the control HTML has been generated, and then call the 
WebForm._AddJavascript() function. That javascript will be added (and 
run) at the end of the page body.


Benoît Minisini.

More information about the User mailing list