“element.dispatchEvent不是函数”在FF3.0的firebug中捕获的js错误 [英] "element.dispatchEvent is not a function" js error caught in firebug of FF3.0

查看:148
本文介绍了“element.dispatchEvent不是函数”在FF3.0的firebug中捕获的js错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在FF3.0中加载索引页面时收到以下错误。抱歉,我无法在此处粘贴脚本,因为它是2030行代码。

i am getting the following error while loading my index page in FF3.0. Sorry, i am unable to paste the script here as it is 2030 lines of code.


element.dispatchEvent不是函数

element.dispatchEvent is not a function

在扩展时它给了我以下的东西,

On expansion it gives me below things,


fire()()prototype.js?1(第3972行)

fire()()prototype.js?1 (line 3972)

_methodized()()prototype.js?1(第246行)

_methodized()()prototype.js?1 (line 246)

fireContentLoadedEvent()prototype.js?1(第4006行)

fireContentLoadedEvent()prototype.js?1 (line 4006)

[中断此错误] element.dispatchEvent(event);

[Break on this error] element.dispatchEvent(event);

element.dispatchEvent(event); 位于prototype.js的第3972行。我在我的索引页面中包含prototype.js和其他几个js文件。

element.dispatchEvent(event); is in line 3972 of prototype.js. I am including prototype.js along with 10s of other js files in my index page.

有没有人遇到过这种错误?请有人解释一下为什么会出现这个错误。

Has anybody came across this kind of error? Please somebody explain me why this error is showing up.

推荐答案

您是否在同一页面上使用jquery和prototype?

are you using jquery and prototype on the same page by any chance?

如果是这样,请使用jquery noConflict模式,否则你将覆盖原型$ function。

If so, use jquery noConflict mode, otherwise you are overwriting prototypes $ function.

noConflict模式被激活通过执行以下操作:

noConflict mode is activated by doing the following:

<script src="jquery.js"></script>
<script>jQuery.noConflict();</script>

注意:通过这样做,美元符号变量不再代表jQuery对象。为了避免重写所有jQuery代码,你可以使用这个小技巧为jQuery创建一个美元符号范围:

Note: by doing this, the dollar sign variable no longer represents the jQuery object. To keep from rewriting all your jQuery code, you can use this little trick to create a dollar sign scope for jQuery:

jQuery(function ($) {
    // The dollar sign will equal jQuery in this scope
});

// Out here, the dollar sign still equals Prototype

这篇关于“element.dispatchEvent不是函数”在FF3.0的firebug中捕获的js错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆