Dialog
A dialog window that allows you to open modal dialog windows on a web page with arbitrary HTML content.
Demo
Source Example
<html>
<head>
<script language="javascript" src="protoplasm.js"></script>
<script language="javascript">
Protoplasm.use('dialog');
function showDialog() {
new Dialog.Frame('Test Dialog', 'This is a test dialog').show();
}
</script>
</head>
<body>
<input type="button" value="Show Dialog" onclick="showDialog()" />
</body>
</html>
Usage
To create and display a new dialog window:
// Unstyled dialog
var d = new Dialog.HTML(content[, options]);
// Dialog with default window frame styling
var d = new Dialog.Frame(title, content[, options]);
// Unstyled dialog with contents fetched from a remote URL
var d = new Dialog.Ajax(url[, options]);
// Display the dialog onscreen
d.show();
Dialog.HTML Parameters:
| Parameter | Required | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| content | yes | A DOM element or HTML string specifying the contents of the dialog | ||||||||||||||||
| options | no |
An object (hash) containing name/value pairs of additional options.
Available options:
|
Dialog.Frame Parameters:
| Parameter | Required | Description |
|---|---|---|
| title | yes | A string specifying the dialog's title |
| content | yes | A DOM element or HTML string specifying the contents of the dialog |
| options | no |
An object (hash) containing name/value pairs of additional options.
See Dialog.HTML above for common options |
Dialog.Ajax Parameters:
| Parameter | Required | Description | ||
|---|---|---|---|---|
| url | yes | The URL to fetch the contents of the dialog from. | ||
| options | no |
An object (hash) containing name/value pairs of additional options.
See Dialog.HTML above for common options Additional options:
|
For more details, see the API documentation for Dialog.