本文介绍了在队列的头部添加事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我已经定义了onclick事件。我想添加额外的回调函数,这将在已经定义的回调之前被调用。 如何在队列的头部添加一个特定事件类型的事件? 解决方案你正在使用jquery框架吗?我正在使用extjs,我找到一个你可以使用或复制的课程 让我们看看 http://extjs.com/deploy/dev/docs/ Ext> EventManager> removeAll() removeAll(String / HTMLElement el): void从元素中删除所有事件处理程序。通常,您将直接在元素上使用 Ext.Element.removeAllListeners ,以支持调用此版本。参数:el: String / HTMLElement要从中删除事件的id或html 元素返回:void 我认为您可以将标签 body 设置为HTMLElement以关闭所有事件。 (未测试对不起) 下载此处 http ://extjs.com/products/extjs/build/ 选择jquery适配器,如果你使用jquery> extcore将足够(它包含EventManager.js)。 另一方面,像crescentfresh(answer n°4),我将此示例代码应用于所有节点事件: var nodes = document.getElementsByTagName('*'); //收集你的节点 for(var i = 0; i< nodes.length; i ++){ var node = nodes [i]; Ext.EventManager.removeAll(node); } } 如果您在使用extjs时遇到问题,请通知我如果我的回答是有用的,可以帮助我,并为我投票。 I have already defined onclick event. I want to add additional call back function, that will be invoked BEFORE already defined callback. How to add an event in the head of the queue for concrete event type? 解决方案 Are you working with jquery framework ? I'm currently working with extjs and i found a class you can use or copy Lets see on http://extjs.com/deploy/dev/docs/ Ext > EventManager > removeAll() removeAll( String/HTMLElement el ) : void Removes all event handers from an element. Typically you will use Ext.Element.removeAllListeners directly on an Element in favor of calling this version. Parameters: el : String/HTMLElement The id or html element from which to remove the event Returns: voidI think You can set the tag body as HTMLElement to shut down all events. (not tested sorry)Download here http://extjs.com/products/extjs/build/ > select jquery adapter if you are working with jquery > extcore will suffice (it contain EventManager.js ).On the other way, like crescentfresh (answer n°4), i made this sample code to apply to all node events :var nodes = document.getElementsByTagName('*'); // collect your nodes howeverfor(var i=0; i < nodes.length; i++) { var node = nodes[i]; Ext.EventManager.removeAll(node); }}Please let me know if you have trouble using extjs i can help, and vote for me if my answer is useful. 这篇关于在队列的头部添加事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 23:38