var script = document.createElement("SCRIPT"); script.src = "myscript.js"; document.getElementsByTagName("HEAD")[0].appendChild(script);