日期:2014-05-16 浏览次数:20365 次
//加载新的js function _GetJsData(url, callback) { var scripts = document.createElement("script"); document.body.appendChild(scripts); scripts.onload = function() { callback(); document.body.removeChild(this); }; scripts.onreadystatechange = function() { if (this.readyState == "loaded") { callback(); document.body.removeChild(this); } }; scripts.charset = "GBK"; scripts.src = url; } _GetJsData('http://www.uefirst.com/index.js',isok); var isok=function(){alert('isok')};
var head = document.getElementsByTagName("head")[0] || document.documentElement; var script = document.createElement("script"); script.src = s.url; // Handle Script loading // Attach handlers for all browsers script.onload = script.onreadystatechange = function() { if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) { done = true; jQuery.handleSuccess( s, xhr, status, data ); jQuery.handleComplete( s, xhr, status, data ); // Handle memory leak in IE script.onload = script.onreadystatechange = null; if ( head && script.parentNode ) { head.removeChild( script ); } } }; } // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); // We handle everything