Adding events: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 20: | Line 20: | ||
function(){document.getElementById('myOutput').innerHTML = ' ';}, | function(){document.getElementById('myOutput').innerHTML = ' ';}, | ||
myPoint2); | myPoint2); | ||
</jsxgraph> | </jsxgraph> | ||
Line 28: | Line 27: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
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 = ' ';}, | |||
myPoint); | |||
myPoint.hasPoint = function(){return false; }; | |||
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 = ' ';}, | |||
myPoint2); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] |
Revision as of 11:26, 28 July 2010
<p id="myOutput"> </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 = ' ';},
myPoint);
myPoint.hasPoint = function(){return false; };
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 = ' ';},
myPoint2);