No.1直接document.write

<script language="javascript">
document.write("<script src=’test.js’><\/script>");
</script>

No.1动态改变已有script的src属性

<script src=” id="s1"></script>
<script language="javascript">
s1.src="test.js"
</script>

No.1动态创建script元素
<script>
var s2 = document.createElement("script");
s2.src="test.js"
document.body.insertAdjacentElement("BeforeBegin",s2);
</script>


评论

该日志第一篇评论

发表评论

评论也有版权!