1、Ext.MessageBox.alert()
调用格式:
alert( String title, String msg, [Function fn], [Object scope] )
参数说明:
title:提示框的标题。
msg:显示的消息内容。
[Function fn]:(可选)回调函数。
[Object scope]:(可选)回调函数的作用域。
ExtJS MessageBox alert支持HTML格式文本。
Ext.onReady(function () {
Ext.MessageBox.alert("提示", "Hello World !", function (id) { alert("单击的按钮是:" + id); });
});
2、Ext.MessageBox.confirm()
调用格式:
confirm( String title, String msg, [Function fn], [Object scope] )
Ext.onReady(function () {
Ext.MessageBox.confirm("提示", "请单击我,做出选择!", function (id) { alert("单击的按钮是:" + id); });
});
3、Ext.MessageBox.prompt()
调用格式:
confirm( String title, String msg, [Function fn], [Object scope], [Boolean/Number multiline], [String value] )
参数说明:
[Boolean/Number multiline]:设置为false将显示一个单行文本域,设置为true将以默认高度显示一个多行文本区。或者以像素为单位直接设置文本域的高度。默认为false。
Ext.onReady(function () {
Ext.MessageBox.prompt("提示", "请输入内容:", function (id, msg) { alert("单击的按钮ID是:" + id + "\n" +"输入的内容是:" + msg); }, this, true, "我是默认值");
});
4、Ext.MessageBox.show()
Ext.onReady(function () {
Ext.MessageBox.show({
title: "提示",
msg: "三个按钮、一个多行文本域",
modal: true,
prompt: true,
value: "请输入",
fn: function (id, msg) {
Ext.MessageBox.alert("单击的按钮id是:" + id + "\n" + "输入的内容是:" + msg);
},
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.QUEATION
});
});
本文详细介绍了ExtJS MessageBox组件的使用方法,包括alert、confirm、prompt和show四个方法的功能和参数说明,提供了实例代码演示。
1686

被折叠的 条评论
为什么被折叠?



