javascript - Run function on click in an specific container -


i have 2 questions:

first how can change function, triggerd when user clicks on div id "canvascontent":

event.add(window, "load", function() { 

and more important how can define function of button below triggerd when function of above has been triggerd first?

<input type="button" onclick="sketch.todataurl()" style="" value="speichern"> 

thanks!

event.add isn't thing, event object is.

//set variable both functions have scope it. var canvasclicked = false;  //add 'click' event dom element "canvascontent" //you use .addeventlistener() document.getelementbyid("canvascontent").onclick = function(e) {     //do whatever     canvasclicked = true; };  //call sketch data when button clicked function sketchdata() {     //only sketch dataurl if canvas has been clicked.     if (canvasclicked) {         sketch.todataurl()     } } 

and then...

<input type="button" onclick="sketchdata()" style="" value="speichern"> 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -