MessageBox with JavaScript

I am a big fun of JavaScript and jQuery. I enjoy the most when coding with javascript. Here is one of the example of my javascript functions. This is MessageBox functionality with javascript and jQuery.

When developing a web page, time to time we needs a MessageBox to get confirmation from user, or to show some information or warning. Default alert function of browsers is not enough and it is not expendable. Because of that i have developed my MesasgeBox function with javascript and jQuery. I hope it will be useful for you.

Here are some samples of usage:
function showOKMessage() {
    MessageBox.show('This is the sample message without title and default OK button.');
}
function showYesNoMessage() {
    var message = 'Are you sure you want to delete?';
    var buttons = [
        new MessageBoxButton('Yes', function () { alert('Yes button is clicked.') }),
        new MessageBoxButton('No', function () { alert('No button is clicked') })
    ];
    var title = 'Confirmation';
    MessageBox.show(message, buttons, title);
}
You can find source code and sample usage on

0 comments:

Post a Comment