function include_js(file,call) { var _doc = document.getElementsByTagName('head')[0]; var js = document.createElement('script'); js.setAttribute('type', 'text/javascript'); js.setAttribute('src', file); _doc.appendChild(js); if (!/*@cc_on!@*/0) { //if not IE //Firefox2、Firefox3、Safari3.1+、Opera9.6+ support js.onload js.onload = function () { call.apply(this); } } else { //IE6、IE7 support js.onreadystatechange js.onreadystatechange = function () { if (js.readyState == 'loaded' || js.readyState == 'complete') { call.apply(this); } } } return false; } 实例: include_js(__path__+'/js/jquery.js',function(){ $.post("/404/404.php", { "rewrite":"yes", "lastModified":ms, "url":window.location.href } ); });