S
stroumf
Hey,
My problem is the following:
I need to use functions from different javascripts and I don't want to
load all the javascripts initially. So I need to load the scripts on
demand.
Now I know how I can load a script dynamically:
function loadScript(scriptname) {
var e = document.createElement("script");
e.src = scriptname+".js";
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
in script.js I have a function test()
Now I have a function where I first check whether the required script
is loaded and if not I call the function above (loadScript). After the
check (and possibly load) and excecute the function from the loaded
script.
Now in firefox this is a problem, cause firefox is still loading the
script while I try to excecute the function from that script. How can I
solve this problem?
thanx in advance
My problem is the following:
I need to use functions from different javascripts and I don't want to
load all the javascripts initially. So I need to load the scripts on
demand.
Now I know how I can load a script dynamically:
function loadScript(scriptname) {
var e = document.createElement("script");
e.src = scriptname+".js";
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
in script.js I have a function test()
Now I have a function where I first check whether the required script
is loaded and if not I call the function above (loadScript). After the
check (and possibly load) and excecute the function from the loaded
script.
Now in firefox this is a problem, cause firefox is still loading the
script while I try to excecute the function from that script. How can I
solve this problem?
thanx in advance