<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>监听点改变的事件</title>
</head>
<body>
<p id="xy"></p>
<div id="applet"></div>
<script src="../GeoGebra/deployggb.js"></script>
<script>
var applet1 = new GGBApplet({filename: '2d.ggb', appletOnLoad: function() {
ggbApplet.registerUpdateListener('pointChanged');
pointChanged('C');
}});
applet1.setHTML5Codebase('../GeoGebra/HTML5/5.0/web/', true);
window.onload = function() {
applet1.inject('applet', 'html5');
};
function pointChanged(name) {
if (ggbApplet.getObjectType(name) === 'point') {
document.getElementById('xy').innerText = name + ': (' + ggbApplet.getXcoord(name) +
', ' + ggbApplet.getYcoord(name) + ')';
}
}
</script>
</body>
</html>