Canvas/drawing api event listener

Hello there,

I’m not that familiar with Javascript so this hopefully is an easy question to answer.

I have a <canvas> element on which I have drawn a number of lines using the Line ‘class’ listed below.

The question is, can these lines accept event listeners? I don’t seem able to get it working so any help would be greatly appreciated.

All the best


function Line(name, date, length){
//alert("Yo: " + name + date + length);
// Get the canvas element.
var elem = document.getElementById(name);
if (!elem || !elem.getContext) {

// Get the canvas 2d context.
var context = elem.getContext(‘2d’);
if (!context) {

context.strokeStyle = ‘#f6c540’; //
context.lineWidth = 2;
context.moveTo(date, 0);
context.lineTo(date, length);

this.addEventListener(“mouseover”, handleMouse, true);