chrome console 调试 引入 jquery等外部库

var importJs=document.createElement('script')  //在页面新建一个script标签
importJs.setAttribute("type","text/javascript")  //给script标签增加type属性
importJs.setAttribute("src", 'https://cdn.bootcss.com/jquery/3.3.1/jquery.js') //给script标签增加src属性, url地址为cdn公共库里的
document.getElementsByTagName("head")[0].appendChild(importJs)//把importJs标签添加在页面

猜你喜欢

转载自www.cnblogs.com/Chary/p/9400240.html