change a text box in Geogebra using a js input box

geouser shared this question 10 years ago
Answered

Hello everybody,


I want my students to insert their names in a ggb file using an input box with js, and hide the input box after they've done their construction, so that they can't change the name.


The problem is that if I want to use the instruction "evalCommand", they have to write their names in " " (if not, ggb doesn't recognize it as a text).


Can't somebody help me? thanks in advance!


The code is this one:



    <applet name="ggbApplet" code="geogebra.GeoGebraApplet" archive="geogebra.jar"

    codebase="./"

    width="700" height="400"mayscript="true">

    <param name="filename" value="file.ggb"/>

    <param name="java_arguments" value="-Xmx512m -Djnlp.packEnabled=true" />

    <param name="cache_archive" value="geogebra.jar, geogebra_main.jar, geogebra_gui.jar, geogebra_cas.jar, geogebra_export.jar, geogebra_properties.jar" />

    <param name="cache_version" value="3.2.46.0, 3.2.46.0, 3.2.46.0, 3.2.46.0, 3.2.46.0, 3.2.46.0" />


    <param name="allowRescaling" value="true" />

    Sorry, the GeoGebra Applet could not be started. Please make sure that Java 1.4.2 (or later) is installed and active in your browser (<a href="http://java.sun.com/getjava... here to install Java now</a>)

    </applet>


    <p>

    </p>

    <p><span style="font-size:small">Virgínia Carmona, Creat amb <a href="http://www.geogebra.org/"; target="_blank" >GeoGebra</a></span></p></td></tr>

    </table>


    <form>

    <p align=center>

    Write your name:

    <input type="text" name="T1" size="20" value="" >

    <input type="button" value="Acceptar" name="B1"

    onclick="document.ggbApplet.evalCommand('a='+T1.value);">


    </p>

    </form>

Comments (1)

photo
2

Does this do the trick:

    document.ggbApplet.evalCommand('a="'+T1.value+'"');

cheers,

Florian

© 2021 International GeoGebra Institute