The following Demo supports callbacks and can be used directly by referencing modalDialog.js. There is no shadow of Jquery
global.js
//Modaldialog
function modalDialog() {
this.uri ="about:blank"; //Address
this.title = null; / /Title
this.width = 400; //Default width
this.height = 300; //Default height
this.borderColor = "black"; //Border color
this.borderWidth = 2; //Border width
this.callback = null; //Callback method
this.background = "black";
this.titleBackground = "silver";
}
modalDialog. prototype.url = this.uri; //This is possible without extension, but the page will only prompt that this property cannot be found
modalDialog.prototype.title = this.title;
modalDialog.prototype.width = this.width;
modalDialog.prototype.height = this.height;
modalDialog.prototype.background = this.background;
modalDialog.prototype.borderWidth = this.borderWidth;
modalDialog.prototype. borderColor = this.borderColor;
modalDialog.prototype.titleBackground = this.titleBackground;
modalDialog.prototype.callback = this.callback;
//Trigger callback method
modalDialog.prototype.call = function (callback) { if (callback != null) callback(this); if (this.callback != null) this.callback(); }
//Show
modalDialog.prototype.show = function () {
var js = window.js;
//Implement the display details inside
var x = js.bodyWidth, y = js.bodyHeight;
//First create a layer mask to cover the entire body
var zdiv = "zdiv"; //mask layer id
document.body.innerHTML = "
";
var mdiv = "mdiv"; //Modal window layer id
document.body.innerHTML = "
"
//Add title
(this.title ! = null ? "
" this.title "
" : "" )
"
" ;
}
modalDialog.prototype.close = function () {
document.body.removeChild(window.js.$("mdiv"));
document.body.removeChild(window. js.$("zdiv"));
}
Use window.parent.md.call() to trigger the callback in the modalDialog page Function