日期:2014-05-16 浏览次数:20407 次
<script> var js = document.createElement("script"); document.getElementsByTagName("head")[0].appendChild(js); js.src = 'http://code.jquery.com/jquery-1.4.2.js'; </script> <script type="text/javascript"> alert($) </script>
<script type="text/javascript"> var js = document.createElement("script"); js.src = 'http://code.jquery.com/jquery-1.4.2.js'; document.getElementsByTagName("head")[0].appendChild(js); </script> <script type="text/javascript"> alert($) </script>
<script type="text/javascript"> var js = document.createElement("script"); document.getElementsByTagName("head")[0].appendChild(js); js.src = 'http://code.jquery.com/jquery-1.4.2.js'; alert($) </script>
<script id="a"></script> <script type="text/javascript"> var a=document.getElementById('a'); a.src = 'http://code.jquery.com/jquery-1.4.2.js'; alert($) </script>
<script id="a" ></script> <script type="text/javascript"> var a=document.getElementById('a'); a.src = 'http://code.jquery.com/jquery-1.4.2.js'; </script> <script type="text/javascript"> alert($) </script>
function loadJS(url, success) { var domScript = document.createElement('script'); domScript.src = url; success = success || function(){}; domScript.onload = domScript.onreadystatechange = function() { if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) { success(); this.onload = this.onreadystatechange = null; this.parentNode.removeChild(this); } } document.getElementsByTagName('head')[0].appendChild(domScript); } //执行加载外部 JS 文件 loadJS('a.js',function (){ loadJS('b.js',function (){ loadJS('c.js',fu