ModalDialog.js

var Dialog = {
Show: function (url, width, height, objArgument) {
var objArgument = objArgument || window;
var retValue = window.showModalDialog(url, objArgument, ‘scroll=yes;resizable=no;help=no;status=no;center=yes;dialogHeight=‘ + height + ‘px;dialogWidth=‘ + width + ‘px;‘);
if (retValue == undefined) {
return window.returnValue;
}
else
return retValue;
},
CloseAndReturn: function (v) {
if (window.opener) {
//for chrome
window.opener.returnValue = v;
window.close();
} else {
window.returnValue = v;
window.close();
}
},
Close: function () {
window.close();
}
}

 

用法:

parent window :

<script language="javascript" src="ModalDialog.js"></script>
<script type="text/javascript">
function show() {
var ret = Dialog.Show("dialog.html", 200, 300);
alert("return:" + ret);
}
</script>

 

dialog:

<script language="javascript" src="ModalDialog.js"></script>
<script type="text/javascript">
function rt(s) {
Dialog.CloseAndReturn(s);
}
</script>

ModalDialog.js,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。