I am dynamically including .js files on a button click. There is a segregated function to do the same. It doesnt seems to work well. If I put a alert tag in the includeJSFile function, it works well. Else it says init is not defined. Is there peculiarity in how function calls are terminated or something
I am attaching the code snippet below.
Expand|Select|Wrap|Line Numbers
- headTag.appendChild(imageScriptTag);
- includeJSFiles('js/image-slideshow.js','text/javascript');
- includeJSFiles('OpenLayers-2.6/lib/OpenLayers.js','text/javascript');
- includeJSFiles('OpenLayers-2.6/lib/Firebug/firebug.js','text/javascript');
- includeJSFiles("js/mapStandaloneBox.js","text/javascript");
- includeJSFiles('js/dom-drag.js','text/javascript');
- init();
- document.getElementById('GoVid').onclick=checkButtonCall;
- checkButtonCall();
- }
- }
- }
- function includeJSFiles(src,type) {
- var headTag=document.getElementsByTagName('head')[0];
- var scriptTag=document.createElement('script');
- scriptTag.src=src;
- scriptTag.type=type;
- headTag.appendChild(scriptTag);
- return true;
- //console.log(headTag.innerHTML);
- }