Using JavaScript listener functions allows communication with GeoGebra. See GeoGebra JavaScript API for a syntax description of the used methods.