If you aren't satisfied with prompt, confirm, alert or window.open, then this JavaScript dialog box can be your choice. Dialog box is emulated with two DIVs. First DIV overlays whole page (transparency is styled to 60%) while second DIV is positioned at the page center. That's nothing new but JavaScript code is short, well commented and closed in own namespace (for easier integration with other frameworks).
Please try demo and see how to call REDIPS.dialog.show() function:
-
Simple dialog
REDIPS.dialog.show(150, 120, 'Simple dialog') -
Bigger dialog with renamed button
REDIPS.dialog.show(200, 200, 'Bigger dialog with renamed button', 'OK') -
Dialog with two buttons
REDIPS.dialog.show(200, 100, 'Dialog with two buttons', 'Cancel', 'Yes') -
Action on second button
REDIPS.dialog.show(200, 100, 'Action on second button', 'Cancel', 'Yes|button2') -
Action on both buttons (with parameter on second button)
REDIPS.dialog.show(200, 100, 'Action on both buttons', 'Cancel|button1', 'Yes|button2|hello') -
Dialog with image
REDIPS.dialog.show(100, 90, '/path/img1.png') -
Dialog with more images
REDIPS.dialog.show(100, 90, '/path/img1.png,/path/img2.png,/path/img3.png') -
Dialog with more images and text
REDIPS.dialog.show(100, 90, 'Hello!|/path/img1.png,/path/img2.png,/path/img3.png') -
Dialog with image and text
REDIPS.dialog.show(300, 160, 'Have a nice day!|/path/spider1.png') -
Dialog with image, text and action on second button
REDIPS.dialog.show(300, 160, 'Delete image?|/path/spider2.png', 'Cancel', 'Yes|button2') -
YouTube example1
REDIPS.dialog.show(640, 390, 'www.youtube.com/v/2JWaWfKc5Vg') -
YouTube example2
REDIPS.dialog.show(640, 390, 'www.youtube.com/v/8LtMk4DwLzA')
There is option to display one or two buttons in dialog box. After button is pressed, dialog box will be closed. That is the simplest scenario. For each button you can define label, function name and parameter. Labels, function names and parameters are separated with "|". If text ends with jpg, jpeg, gif or png, script will prepare IMG tag and display one or more images. REDIPS.dialog.show() has fade in / out overlay from 0% to 60%. You have option to change maximum overlay transparency and fade speed. Dialog box should be initialized while settings of maximum transparency and fade speed are optional. Here is example of simple configuration:
window.onload = function () {
REDIPS.dialog.init(); // initialize dialog
REDIPS.dialog.op_high = 40; // set maximum transparency to 40%
REDIPS.dialog.fade_speed = 18; // set fade spead (delay is 18ms)
//REDIPS.dialog.close_button = 'x'; // close button definition
};
If input value of REDIPS.dialog.show() contains URL to www.youtube.com video then dialog box will include embedded flash player. YouTube HTML code of flash player can be changed with public property REDIPS.dialog.youtube.
In redips4.tar.gz (8.5KB) package you will find demo and source code. At the end it's important to mention that script passes JSLint verification. And yes, JSLint hurt my feelings ...

@Aaron - It seems like a code page problem. Anyway, in a new 1.5.1 version you can define a character for close button. Here is example how to define Z instead of default character:
Please download new version and try. Hope this improvement will help.
Cheers!
How can use redips in our .net application ...
It shows the error undefine var redips.
@ashok kumar rathore - Here is example of initialization code for using REDIPS.dialog library. You should include REDIPS.dialog on you page:
and execute initialization:
// define redips_init variable var redips_init; // dialog box initialization (called from event) redips_init = function () { REDIPS.dialog.init(); REDIPS.dialog.op_high = 60; REDIPS.dialog.fade_speed = 18; //REDIPS.dialog.close_button = 'Z'; } // add onload event listener if (window.addEventListener) { window.addEventListener('load', redips_init, false); } else if (window.attachEvent) { window.attachEvent('onload', redips_init); }With these two steps REDIPS.dialog should work and you will be able to show dialogs.
Cheers!
Hi,
I need to hide the dialog on timer event if no button clicked in dialog.
I called the hide event and got an error. How can I impleent this ? Could you embed a timer parameter
and close the dialog if no button pressed ?
Thanks.