我想在Window关闭时(点击右上角的"X"),弹出提示框,由用户确认是否关闭窗口,这样该如何实现?
解决方案 »
- 求助,换肤代码js的问题
- 求助,div加了js效果后在IE下透明层不透明了
- 求高人解答firefox插件问题
- 求助,DOM解析是什么概念啊?
- 哪里有张孝详的javascript下载
- 如何获取同名控件的个数啊?
- 选择了选项以后在文本框中就会显示相应的内容,用JS怎么实现?谢谢各位!
- 日期输入
- 如何使点出来的窗口中的链接再点击它时原来的窗口文本框中能显示出文字来?
- 如何在同一个页面,在一个td里, 点击 这个td里面的字如 "换色" 可以把这个td 的bgcolor换成另外一种color呀
- window.functionName = new Function() 有什么特别吗?
- setTimeout()为啥停不下来?
try {
return "是否关闭?";
} catch (e) { }
}
return confirm('是否关闭');
});赶紧结贴吧
return confirm('是否关闭');
});赶紧结贴吧
这个也是了,就是不行的?是否还有什么属性要设置吗?
Ext.onReady(function () {
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
listeners: {
beforeClose: function (_this) {
return confirm("确认删除吗?");
}
} }).show();
});
{
layout : 'fit',
width : 300,
height : 200,
resizable : false,
draggable : true,
closeAction : 'hide',
title : '<span style="font-weight:normal">新增层面</span>',
// iconCls : 'page_addIcon',
modal : true,
collapsible : false,
closable:true,
listeners:{
beforeClose:function(){
return confirm("确认关闭吗?");
}
},
titleCollapse : true,
maximizable : false,
buttonAlign : 'right',
border : false,
animCollapse : true,
animateTarget : Ext.getBody(),
constrain : true,
items : [ formPanel ],
buttons : [
{
text : '保存',
iconCls : 'acceptIcon',
handler : function() {
if (codeWindow.getComponent('dataSourceForm').form.isValid()) {
Ext.Msg.confirm('提示','确认要新增层面吗?',function(btn,text){
if(btn=='yes'){
codeWindow.getComponent('dataSourceForm').form.submit( {
url : './sjjType.ered?reqCode=saveDivlay',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在处理数据,请稍候...',
success : function(form,action) {
store.reload();
var msg = action.result.msg;
Ext.MessageBox.alert('提示',msg);
codeWindow.hide();
},
failure : function(form,action) {
var msg = action.result.msg;
Ext.MessageBox.alert('提示',msg);
codeWindow.getComponent('dataSourceForm').form.reset();
}
});
}
});
} else {
// 表单验证失败
}
}
}, {
text : '重置',
id : 'btnReset',
iconCls : 'tbar_synchronizeIcon',
handler : function() {
clearForm(formPanel.getForm());
}
},{
text : '关闭',
iconCls : 'deleteIcon',
handler : function() {
Ext.Msg.confirm('确认','确认退出该窗口吗?',function (btn,text){
if(btn=='yes')
{
codeWindow.hide();
}
});
}
} ]
});
codeWindow.on('beforeClose',function(){
return confirm("确认关闭?");
});
我这两种方式用了,貌似还是不行?