jsUtils.showMsg()

Displays a message dialog.

jsUtils.showMsg( text, params )
  text - text of the message
  params - a JavaScript object with additional parameters

Returns HTML div element object

This function will display a message dialog. The text of the message is represended by the first parameter. The second parameter is a JavaScript object with additional parameters. Below is the list of these additional parameters:

  
title html, the title of the message
buttons html, the text that will be displayed in the bottom of the dialog (can be used to output buttons)
width integer, the width of the dialog in px
height integer, the height of the dialog in px
modal boolen, indicating whether it is a modal dialog. If not modal, it will hide when user clicks away.
opacity float, a number between 0 and 1 that defines opacity of the screen locking div.

Example 1: Simple

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="system/css/w20-controls.css" />
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function() {
            jsUtils.showMsg('This is my message');
        }
    </script>
<body>
</body>
</html>

Example 2: With parameters

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="system/css/w20-controls.css" />
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function() {
            jsUtils.showMsg('This is my message', { 
                title: 'A Title', 
                buttons: '<input type=button value="close" onclick="jsUtils.hideMsg()">' 
            });
        }
    </script>
<body>
</body>
</html>

Example 3: Loaded via AJAX

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="system/css/w20-controls.css" />
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function() {
            jsUtils.get('some_page.php', {}, function (data) {
                jsUtils.showMsg(data);
            });
        }
    </script>
<body>
</body>
</html>

See Also