如何在另一个js文件中包含js文件 [英] How to include js file inside another js file
本文介绍了如何在另一个js文件中包含js文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在另一个js文件(即file2.js)中包含js文件(即file1.js).
谢谢.
Hi,
i want to know that how can i include js file i.e file1.js in another js file i.e. file2.js.
Thank u.
推荐答案
您需要一个可以动态加载/添加脚本元素的函数.检查链接以获取有关如何执行此操作的4个选项的信息:
http://ntt.cc/2008/02/10/4-ways-to-dynamically-load-external-javascriptwith-source.html [
You would need a function that would load/add the script element dynamically. Check the link for 4 options on how to do it:
http://ntt.cc/2008/02/10/4-ways-to-dynamically-load-external-javascriptwith-source.html[^]
Good luck!
这篇关于如何在另一个js文件中包含js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文