Friday, January 23, 2009

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()}; 

0 comments: