I have test.js
file, it has an initialization function window.onload = function initiliaze() { ... }
, which is invoked whenever the window is created.
I would like to include other javascript file "d3.min.js" , which is located in the same directory as test.js
file is located, into the HTML body when initiliaze()
is called.
This is how I include my javascript file into HTML body, from the same directory:
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "./d3.min.js";
document.body.appendChild(js);
however I still can't call d3.min.js
functions, Firebug shows that d3 is not loaded.