富贵资源网 Design By www.hznty.com
1.直接document.write
<script language=javascript>
document.write(<script src='test.js'><\/script>);
</script>
2.动态改变已有script的src属性
<script src='' id=s1></script>
<script language=javascript>
s1.src=test.js
</script>
3.动态创建script元素
<script>
var s2 = document.createElement(script);
s2.src=test.js
document.body.insertAdjacentElement(BeforeBegin,s2);
</script> 
<head>
<script>
function loadJs(file){
var scriptTag = document.getElementById('loadScript');
var head = document.getElementsByTagName('head').item(0)
if(scriptTag) head.removeChild(scriptTag);
script = document.createElement('script');
script.src = file;
script.type = 'text/javascript';
script.id = 'loadScript';
head.appendChild(script)
}
</script>
</head>
<body onload=loadJs('1.js');loadJs('2.js')>

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com