The method you've described won't work. Rather if you try to embed the JS code through innerHTML it is not going to work.
Instead you can add the JS files through DOM based methods. An example would be the following:
Code:
function loadScript(){
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "your_script_file_name.js"; //Mention the correct path for your requirement
document.body.appendChild(script);
}
Note that I am inserting the script element as the last child of the body element.
The script file that you dynamically insert can have certain function calls in it and it will be triggered as soon as the insertion is over.
Hope this helps.
Bookmarks