标签:
<script language="javascript">
document.write("<script src=‘test.js‘><\/script>");
</script>
第二种、动态改变已有script的src属性
<script src=‘‘ id="s1"></script>
<script language="javascript">
s1.src="test.js"
</script>
第三种、动态创建script元素:
<script>
var oHead = document.getElementsByTagName(‘HEAD‘).item(0);
var oScript= document.createElement("script");
oScript.type = "text/javascript";
oScript.src="test.js";
oHead.appendChild( oScript);
</script>
标签:
原文地址:http://www.cnblogs.com/cshi/p/5464037.html