Page 1 of 1

How to call a JS function?

Posted: Fri Oct 11, 2024 10:08 am
by Caronte3D
I know how to call SpiderBasic functions from JavaScript (prefix: "f_"), but... how to call JS functions from SpiderBasic side?
I tied:
! myFunction()
but an error says: Uncaught ReferenceError: myFunction is not defined

Re: How to call a JS function?

Posted: Fri Oct 11, 2024 10:34 am
by Peter
This (window.myFunction = myFunction) allows you to make a function globally accessible:

Code: Select all

! function myFunction() {
!   alert("!");
! }
! window.myFunction = myFunction;
Call:

Code: Select all

! myFunction();

Re: How to call a JS function?

Posted: Fri Oct 11, 2024 11:32 am
by Caronte3D
That's works!
Thanks (again) by your help ;)