I have the following function calls:
Layout.Controls.sidebar(Button.Add);
Layout.Controls.sidebar(Button.Init);
Layout.Controls.printScreen(Button.Add);
Layout.Controls.theme(Button.Add);
Layout.Controls.theme(Button.Init);
I put the calls inside of a .js file. But how can I make it so these calls are executed when the .js file is loaded?
All scripts that you put in your page using <script>
elements are executed in order, as soon as they're available.
That's the same for inlined scripts ( <script>alert(1);</script>
) or scripts imported from external files ( <script src="somefile.js"></script>
).
You don't have to do anything special : your code in the external js file will be executed as soon as it's loaded.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.