var newScript = document.createElement("script"); newScript.src = "http://www.example.com/my-script.js"; target.appendChild(newScript);