Javascrit global variable

pascal50 shared this question 10 years ago
Answered

Hello,


I can't control a javascript global variable ? JStiti seems to be always undefined ...

https://ggbm.at/545105

Comments (3)

photo
1

Hello,


The "Javascript global" code seems to be executed each time an "javascript" code of an object is launched.


In the joined file I trace them in the java console with the instruction ggbApplet.debug().


And the global code seems to be executed after the object code !

https://ggbm.at/545117

photo
1

The Global JavaScript is only for putting functions in.


If you want to store a value, you must use a GeoGebra variable using ggbApplet.getValue() and setValue().

photo
1

I have some applets with JavaScript global 2D arrays (see attachment).

They seem to work fine (even other more complex applets).

Should I change the JavaScript arrays to GeoGebra lists? (the JavaScript arrays save me some steps forward.)

© 2020 International GeoGebra Institute