Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI Window Plugin - Messager

jQuery EasyUI Window Plugin - Messager


jQuery EasyUI Plugins jQuery EasyUI Plugins


Override the defaults through $.messager.defaults.

A messager provides different styles of message boxes, including alert, confirm, prompt, progress, and so on. All message boxes are asynchronous. Users can use callback functions to perform actions after interacting with a message box.

Depends on

Usage



$.messager.alert('Warning','The warning message');

$.messager.confirm('Confirm','Are you sure you want to delete record?',function(r){

    if (r){

        alert('ok');

    }

});

property

Name Type Description Default value
ok string The text of the OK button. Ok
cancel string The text of the Cancel button. Cancel

Method

Name Parameters Description
$.messager.show options Displays a message window in the bottom-right corner of the screen; the options parameter is a configuration object:
 showType: 定义消息窗口如何显示。可用的值是:null、slide、fade、show。默认是 slide。       

 showSpeed: 定义消息窗口完成显示所需的以毫秒为单位的时间。默认是 600。       

 width:定义消息窗口的宽度。默认是 250。       

 height:定义消息窗口的高度。默认是 100。       

 title:头部面板上显示的标题文本。       

 msg:要显示的消息文本。       

 style:定义消息窗口的自定义样式。       

 timeout:如果定义为 0,除非用户关闭,消息窗口将不会关闭。如果定义为非 0 值,消息窗口将在超时后自动关闭。默认是 4 秒。       

   

 代码实例:     

$.messager.show({ title:'My Title', msg:'Message will be closed after 5 seconds.', timeout:5000, showType:'slide' }); // show message window on top center $.messager.show({ title:'My Title', msg:'Message will be closed after 4 seconds.', showType:'show', style:{ right:'', top:document.body.scrollTop+document.documentElement.scrollTop, bottom:'' } });| onSelect | event | $.messager.alert | title, msg, icon, fn | Display an alert message window. Parameters:
title: The title text displayed on the header panel.
msg: The message text to display.
icon: The icon image to display. Available values are: error, question, info, warning.
fn: The callback function triggered when the window is closed.

 代码实例:     

$.messager.alert('My Title','Here is a info message!','info');| onSelect | event | $.messager.confirm | title, msg, fn | Display a confirmation message window with "OK" and "Cancel" buttons. Parameters:
title: the title text displayed in the header panel.
msg: The message text to display.
fn(b): a callback function that receives true when the user clicks the confirm button and false otherwise.

 代码实例:     

$.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r){ if (r){ // exit action; } });| onSelect | event | $.messager.prompt | title, msg, fn | Display a message window with "OK" and "Cancel" buttons that prompts the user to enter some text. Parameters:
title: The title text displayed on the header panel.
msg: The message text to display.
fn(val): The callback function with the value parameter entered by the user.

 代码实例:     

$.messager.prompt('Prompt', 'Please enter your name:', function(r){ if (r){ alert('Your name is:' + r); } });| onSelect | event | $.messager.progress | options or method | Display a progress message window.
The options are defined as follows:
title: the title text displayed in the header panel. The default value is ''.
msg: The body text of the message box, default value is ''.
text: the text displayed in the progress bar. The default value is undefined.
interval: the time in milliseconds between each progress update. The default value is 300.

 方法定义如下: bar:获取进度条(progressbar)To the象。       

 close:关闭进度窗口。       

   

 Code example:

 显示进度消息窗口。     

$.messager.progress(); Close the message window now.

$.messager.progress('close');

|


jQuery EasyUI Plugins jQuery EasyUI Plugins