Difference between revisions of "Adding events"

From JSXGraph Wiki
Jump to: navigation, search
Line 11: Line 11:
 
             function(){document.getElementById('myOutput').innerHTML = ' ';},  
 
             function(){document.getElementById('myOutput').innerHTML = ' ';},  
 
             myPoint);
 
             myPoint);
myPoint.hasPoint = function(){return false; };
+
myPoint.hasPoint = function(){return false; }; // User can not move "A" anymore.
  
 
var myPoint2 = brd.create('point',[-1,1], {size:5});
 
var myPoint2 = brd.create('point',[-1,1], {size:5});
Line 35: Line 35:
 
             function(){document.getElementById('myOutput').innerHTML = ' ';},  
 
             function(){document.getElementById('myOutput').innerHTML = ' ';},  
 
             myPoint);
 
             myPoint);
myPoint.hasPoint = function(){return false; };
+
myPoint.hasPoint = function(){return false; }; // User can not move "A" anymore.
  
 
var myPoint2 = brd.create('point',[-1,1], {size:5});
 
var myPoint2 = brd.create('point',[-1,1], {size:5});

Revision as of 12:28, 28 July 2010

 

<p id="myOutput">&nbsp;</p>
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-4,4,4,-4], keepaspectratio:true});
var myPoint = brd.create('point',[1,1], {size:5});
JXG.addEvent(myPoint.rendNode, 'mouseover', 
             function(){ document.getElementById('myOutput').innerHTML = "Point "+this.name;}, 
             myPoint);
JXG.addEvent(myPoint.rendNode, 'mouseout', 
             function(){document.getElementById('myOutput').innerHTML = '&nbsp;';}, 
             myPoint);
myPoint.hasPoint = function(){return false; };  // User can not move "A" anymore.

var myPoint2 = brd.create('point',[-1,1], {size:5});
JXG.addEvent(myPoint2.rendNode, 'mouseover', 
             function(){ document.getElementById('myOutput').innerHTML = "Point "+this.name;}, 
             myPoint2);
JXG.addEvent(myPoint2.rendNode, 'mouseout', 
             function(){document.getElementById('myOutput').innerHTML = '&nbsp;';}, 
             myPoint2);