You should check if things work in the browser:
function init() {
canvasCircle = document.getElementById("canvas_circle");
if(canvasCircle && canvasCircle.getContext) {
contextCircle = canvasCircle.getContext('2d');
return setInterval(draw, 10);
} else {
alert('No canvas!');
}
}
The if statement here checks if
canvasCircle
has been found, and if the
getContext
function is available.
init
should only be called when the page has loaded or it may not be able to find the canvas element - replace
init();
with
window.onload=init;