27
rated 0 times
[
31]
[
4]
/ answers: 1 / hits: 18970
/ 15 Years ago, thu, september 3, 2009, 12:00:00
I would like to know how to load an external Javascript into my document from a function.
More From » function
I would like to know how to load an external Javascript into my document from a function.
This is one way:
function loadDaFun() {
var script = document.createElement('script');
script.src = '/path/to/your/script.js';
var head = document.getElementsByTagName(head)[0];
head.appendChild(script);
}