//建立一個script標籤 var importJS = document.createElement("script"); //設置屬性 importJS.setAttribute("type","text/javascript"); importJS.setAttribute("src","http://code.jquery.com/jquery-latest.js"); //獲取head var head = document.getElementsByTagName("head")[0]; //添加script標籤到head head.appendChild(importJS);