Getting State of Objects using Javascript

Introduction
The applet presented below help to demonstrate a few simple examples of how Javascript in Geogebra is used to get the state of objects. [br][br]In particular the script commands used are :[br] [u]State [/u] [u]Object[/u][br]getValue - value in a number variable[br]getValueString - text  in a textbox [br]getCaption - caption of a button[br][br]The above commands are found in [url=https://wiki.geogebra.org/en/Reference:JavaScript]Geogebra Manual's section on Reference:Javascript[/url]
Notes.
Script in button1's On Click [br]SetValue[n,If[n<4,n+1,1]][br][br]script command in button2 On Click :[br]value1 = ggbApplet.getValue('n'); alert("1. n = "+value1+" now");[br][br]script command in button3 On Click :[br]text2 = ggbApplet.getValueString('textTitle'); alert("2. textTitle contains the string : \n"+text2);[br][br]script command in button4 On Click[br]text3 = ggbApplet.getCaption('button1',false); alert("3. The caption of button1 now is : "+text3);[br][br] For the getCaption() command, the second parameter - boolean must be included.[br] false - if no substitution values eg. %v, %n, are used[br] true - if you need to extract the substitution values eg %v, %n]

Information: Getting State of Objects using Javascript