我有两个js文件。一种使用 prototype
语法和 jQuery
。不知怎的,他们不一起工作。我可以尝试使用类似的 filename.functionname 来调用文件内的函数。
请告诉我执行此操作的语法,或者是否有其他方法可以使 protoype
和 jQuery
一起运行,因为它们的某些部分语法发生冲突。
最佳答案
不能通过文件名调用函数。
使用jquery noCoflicts
文档中的简短示例:
<script type="text/javascript" src="other_lib.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
// Code that uses other library's $ can follow here.
</script>
关于php - 使用 js 文件名调用 javascript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351516/