Maison> interface Web> js tutoriel> le corps du texte

如何动态引入JS文件

php中世界最好的语言
Libérer: 2018-05-23 14:43:03
original
1948 Les gens l'ont consulté

这次给大家带来如何动态引入JS文件,动态引入JS文件的注意事项有哪些,下面就是实战案例,一起来看一下。

index.html

       
   
Copier après la connexion

test.js

alert("hello! I am test.js"); var str="1";
Copier après la connexion

dynamic.js

//第一种方式:直接document.write 但这样会把当前的页面全覆写掉 //document.write("