" element.dispatchEvent不是函数"FF3.0的萤火虫捕获了js错误 [英] "element.dispatchEvent is not a function" js error caught in firebug of FF3.0

查看:105
本文介绍了" element.dispatchEvent不是函数"FF3.0的萤火虫捕获了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和原型?

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

如果是这样,请使用jquery noConflict模式,否则您将覆盖原型$函数.

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

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

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