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 }); });