Code for adding JS Files at runtime and then executing Functions from currently loaded file.

/*——-This works for IE and non IE as well—————-*/
var oScript = document.createElement(“script”);
oScript.src = fileName.js;
document.body.appendChild(oScript);
if(browser==”NonIE”)
oScript.onload = function(){callAFunction()};
else
oScript.onreadystatechange = function(){callAFunction()};

Leave a Reply

Your email address will not be published. Required fields are marked *