JavaScript: How to call functions from events -


i'm starting learn javascript , know how call function event. way know anonymous functions (see code) , don't know how call in simpler way. in advance!

    function example (){         document.getelementbyid("mydiv").onclick = function (){             example2 ();         }     } 

you can assign name:

function example (){     document.getelementbyid("mydiv").onclick = example2; } 

Comments