我在 FF3.0 中加载索引页时出现以下错误。抱歉,我无法将脚本粘贴到此处,因为它有 2030 行代码。
element.dispatchEvent is not a function
在展开时它给了我下面的东西,
fire()()prototype.js?1 (line 3972)
_methodized()()prototype.js?1 (line 246)
fireContentLoadedEvent()prototype.js?1 (line 4006)
[Break on this error] element.dispatchEvent(event);
element.dispatchEvent(event);
在 prototype.js 的第 3972 行。我在我的索引页面中包括了 prototype.js 和其他 10 个 js 文件。
有人遇到过这种错误吗?请有人向我解释为什么会出现此错误。
最佳答案
你有没有在同一个页面上使用 jquery 和原型(prototype)?
如果是这样,请使用 jquery noConflict 模式,否则您将覆盖原型(prototype) $ 函数。
通过执行以下操作激活无冲突模式:
<script src="jquery.js"></script>
<script>jQuery.noConflict();</script>
注意:通过这样做,美元符号变量不再代表 jQuery 对象。为了避免重写所有 jQuery 代码,您可以使用这个小技巧为 jQuery 创建一个美元符号范围:
jQuery(function ($) {
// The dollar sign will equal jQuery in this scope
});
// Out here, the dollar sign still equals Prototype
关于javascript - "element.dispatchEvent is not a function"FF3.0的firebug抓到js错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/980697/