I have a template <script> in my html:
 <script>
         window.daySelected = window.currentdate;
         window.monthSelected = window.currentmonth;
         window.yearSelected = window.currentyear;
 </script>
Here is an example of an external script file loading on a click event: Jquery load script on click event.
Is there a way to load the template script in my html on a click event?


function setDates(){ window.daySelected = window.currentdate; window.monthSelected = window.currentmonth; window.yearSelected = window.currentyear; }and<img src='blah' onclick='setDates()' />