これを実行しようとすると、Chrome で型エラーが発生します: Code Update
// Get the drawing canvas
canvas = $('#drawing');
context = canvas[0].getContext('2d');
function resizeCanvas() {
canvas.attr({'width' : $(window).width()});
canvas.attr({'height' : $(window).height() - 158});
var dataURL = canvas[0].toDataURL('image/png');
context.drawImage(dataURL, 0, 0);
}
$(window).resize(function() {
resizeCanvas();
}); resizeCanvas();
// Various event handlers after this.
どうして!?