HTML5 Canvas [43]
button:
formElement = document.getElementById("createImageData");
formElement.addEventListener('click', createImageDataPressed, false);
Then, in the createImageDataPressed() event handler, we call the toDataURL() method of the Canvas object (theCanvas), and set the value of the imageDataDisplay