javascript - Is it possible to run a function that is '2-deep' within another function? -
javascript - Is it possible to run a function that is '2-deep' within another function? -
i need execute function window.onload
event. function want run lies within function's function. know can run function function by
function1(){ function2(); } function2(){ ...a process... }
but since cannot run window.onload
event within 'overall' function needs @ 'top layer'. tried doing didn't work think want do.
<script> function(){ function1(){ ..some stuff.. } function2(){ function1(); } } window.onload = function2; </script>
i cannot run function1 window.onload
event bound object onclick event.
any suggestions how can solve this??
you should study , larn different javascript patterns allow construction code in predictable manner.
http://addyosmani.com/resources/essentialjsdesignpatterns/book/ fantastic resource , show things need know.
each pattern details implementation, advantages , disadvantages.
here's 1 illustration uses module pattern:
// global module var mymodule = (function () { function privatemethod1() { ... } function privatemethod2() { ... } homecoming { publicmethod: function(){ privatemethod1(); } }; })(); mymodule.publicmethod();
javascript jquery
Comments
Post a Comment