使用HTML一次调用两个javascript文件
Calling two javascript files at once using HTML
我有一个html文件和两个。js文件。我把多个脚本标签在一个html文件,因为我使用骨干js。
<html>
<body>
<script type="text/x-template" id="my-template">
some html contents
<script src="/javascripts/validation.js"></script>
<script src="/javascripts/other.js"></script>
</script>
<script type="text/x-template" id="myfile-template">
some html contents
</script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</body>
</html>
我的问题是,我无法从我的模板脚本调用2个js文件。在上面的代码中,只有"validate .js"被调用,如果我把"other.js"放在前面,那么只有"other.js"被调用。
<script src="/javascripts/other.js"></script>
<script src="/javascripts/validation.js"></script>
有人能帮我吗?
你不能把标签放在其他标签中。
如果你想导入你的两个JS文件,只需这样做:
<!-- Include external JS code -->
<script src="/javascripts/validation.js"></script>
<script src="/javascripts/other.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<!-- local JS code -->
<script type="text/x-template" id="my-template">/* some local JS code */</script>
<script type="text/x-template" id="myfile-template">/* some local JS code */</script>
相关文章:
- 组合两个javascript函数
- 比较包含多个值对的两个JavaScript数组
- 为什么这两个JavaScript函数调用具有相同的“;这个“;价值
- 无法延迟iPhone/iPad上的两个JavaScript操作
- 比较IF条件下的两个javascript数值
- 我可以在两个javascript文件之间传递一个字符串吗?
- 为标记调用href中的两个javascript函数
- 如何执行两个javascript函数
- 两个javascript网络工作者连续打印输出-为什么不同时打印呢
- 如何手动绑定两个javascript文件
- 两个javascript脚本的非独立性
- 合并两个Javascript数组,一次合并三个元素
- 为同一标记中的两个不同事件调用两个javascript方法
- 将两个Javascript函数组合到一个窗口中.nload不起作用
- 结合两个JavaScript函数
- IE可以同时执行两个JavaScript函数吗?
- 两个 JavaScript 文件,哪个方法首先调用
- 在 html 中的两个 JavaScript 之间传递值
- 两个 JavaScript 对象具有相同的属性实现方式,但原型不同
- 如何将两个Javascript函数合二为一