创建了一个window,给window绑定了beforeclose事件,然后调用用removeListener方法,但是无效无法移除beforeclose事件
代码如下: win = new Ext.Window({
id: 'test',
footer : false,
width: 640,
height: 480,
iconCls: 'accordion'
}); win.on('beforeclose', function() {alert(1);}, this);
win.removeListener('beforeclose');
win.show();
当关闭窗体时,系统仍然会弹出对话框alert(1);,请问如何移除掉'beforeclose'事件?
代码如下: win = new Ext.Window({
id: 'test',
footer : false,
width: 640,
height: 480,
iconCls: 'accordion'
}); win.on('beforeclose', function() {alert(1);}, this);
win.removeListener('beforeclose');
win.show();
当关闭窗体时,系统仍然会弹出对话框alert(1);,请问如何移除掉'beforeclose'事件?
解决方案 »
- 类似京东的框框查询,请问这是什么效果
- js查找字符中url 求大侠指点啊
- 同样一段弹出窗口代码,IE和FF显示效果大不同
- 同一个页面出现两个以上window.onload起冲突的问题
- 如何用JavaScript输出本地一个HTML页面的HTML代码?
- 问一个简单的问题! 我在 onsubmit时,想调用两个javascript函数! 应该怎么写!
- 网页对话框中的页面如何在对话框中刷新?
- 数组问题:如何得到数组aaa的长度???(aaa.length不行),请高手指教!!!
- 新手发帖
- easyUI-form表单提交,正确返回但是不执行success
- Table点击表头排序的js代码问题
- js 无法读取输入后的值
win = new Ext.Window({
id: 'test',
footer : false,
width: 640,
height: 480,
iconCls: 'accordion'
});
var f=function() {alert(1);};
win.on('beforeclose', f, this);
win.removeListener('beforeclose',f,this);
win.show();
removeListener( String eventName, Function handler, [Object scope] ) : void
Removes an event handler.
Removes an event handler.
Parameters:
eventName : String
The type of event the handler was associated with.
handler : Function
The handler to remove. This must be a reference to the function passed into the addListener call.scope : Object
(optional) The scope originally specified for the handler.
Returns:
void
win = new Ext.Window({
id: 'test',
footer : false,
width: 640,
height: 480,
iconCls: 'accordion'
});
aa=function() {alert(1);}
win.on('beforeclose',aa , this);
win.removeListener('beforeclose',aa , this);
win.show();
引用 2 楼 sohi