example
<script>
var script = document.createElement("script");
script.addEventListener("load", function(event) {
console.log("Script finished loading and executing");
});
script.src = "http://example.com/example.js";
script.async = true;
document.getElementsByTagName("script")[0].parentNode.appendChild(script);
</script>
或者
<script>
var script = document.createElement("script");
script.onload = function(event) {
console.log("Script finished loading and executing");
};
script.src = "http://example.com/example.js";
script.async = true;
document.getElementsByTagName("script")[0].parentNode.appendChild(script);
</script>