能不能在js中引入jquery然后在html中只引入js?
1个回答
展开全部
(function(){varjsfiles=newArray(script/jquery.js,script/aaa.js);varagent=navigator.userAgent;vardocWrite=(agent.match(MSIE)||agent.match(Safari));if(docWrite){varallScriptTags=newArray(jsfiles.length);}varhost=lib/;//文件的所在目录for(vari=0,len=jsfiles.length;i<len;i++){if(docWrite){allScriptTags[i]=<scriptsrc='+host+jsfiles[i]+'</script;}else{vars=document.createElement(script);s.src=host+jsfiles[i];varh=document.getElementsByTagName(head).length?document.getElementsByTagName(head)[0]:document.body;h.appendChild(s);}}if(docWrite){document.write(allScriptTags.join());}})();试试吧~这个是通过js引用JS的方法,需要引用的JS放到数组里就行了jsfiles
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询