View Full Version : Making a popup on Canvas scroll over

10-02-2011, 08:46 PM

I've got a HTML5 canvas graph and want to make, using JavaScript a small pop up appear when you click on a dot on the graph.

Mock up:

I've got this code

<script type="text/javascript">

var _get = (function(){
var i, p,x, obj = {};
x = location.search.slice(1).split('&');
for(var i = 0; i < x.length;i++){
p = x[i].indexOf('=');
obj[x[i].slice(0,p)] =
return obj

var c=document.getElementById("myCanvas");
var cxt=c.getContext("2d");
var x = '400';

var d=document.getElementById("myCanvas");
var ctx=d.getContext("2d");
ctx.arc(75, 75, 5, 0, Math.PI*2, true);


I have found how I can do it by having a mouse over but it needs to be on click as they need to be able to then click on a link in the pop up area. The content of the pop up will come from a POST string set on the previous page.

I am a newbie to JavaScript although well experienced PHP programmer - can someone point me in the right direction please? Thank you