We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关键字: onreadystatechange loaded complete readyState onerror
var script = document.createElement(“script”); var head = document.getElementsByTagName(“head”)[0]; script.type = “text/javascript”; script.src = “//i.alicdn.com/resource.js”; // 绑定资源加载成功事件 script.onreadystatechange = function( ){ // 判断资源加载状态是否为加载成功或加载完成 if(/^(loaded|complete)$/. test (script.readyState) ) { script.onreadystatechange = null; . . . . } }; // 绑定资源加载失败事件 script.onerror = function( ) { . . . . }; head.insertBefore (script , head.firstChild)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现动态加载一个 JavaScript 资源
The text was updated successfully, but these errors were encountered: