1. add <base target="_self" /> in the page of dialog, no need to use frame:

<head>

<base target="_self" />

2. add div_conver class in style file

/*-------------------------------- used by dialog.js ----------------------------------------------------------*/.div_cover
{
    z-index:; left:0px; top:0px; width:%; height:%; position:); opacity:0.6; display:none;
}

3. Modify code get dialog argument. for example, in UserSelector.js

if(window.dialogArguments.insertXML!=null)
{
     GetInsertXML=window.dialogArguments.insertXML;    // Wrong
}

Now: GetInsertXML = window.dialogArguments;

var Dialog = {
    Show: function (url, width, height, objArgument) {
        if (isChrome()) {
            showCover();
        }

        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 (isChrome()) {
            hideCover();
            retValue = window.returnValue;
        }
        )//for IE, convert string to array, IE will lose array when window close
            retValue = retValue.split(",");

        return retValue;
    },

    GetDialogArguments : function(){
        return window.dialogArguments;
    },

    CloseAndReturn: function (v) {
        var retValue;
        if (isIE() && Object.prototype.toString.call(v) === "[object Array]") //for IE, convert array to string, IE will lose array when window close
            retValue = v.join();
        else
            retValue = v;

        if (isChrome()) {
            //for chrome
            window.opener.returnValue = retValue;
            window.close();
        } else {
            window.returnValue = retValue;
            window.close();
        }
    },

    Close: function () {
        window.close();
    }
}

function isIE() {
    ;
}

function isChrome() {
    return navigator.appName == "Netscape";
}

function showCover() {
    setCoverDisplay("block");
}

function hideCover() {
    setCoverDisplay("none");
}

function setCoverDisplay(display) {
    if (document.getElementById("winCover") != null)
        document.getElementById("winCover").style.display = display;

    ].document.getElementById("winCover") != null)
        window.top.frames[].document.getElementById("winCover").style.display = display;

    ].document.getElementById("winCover") != null)
        window.parent.frames[].document.getElementById("winCover").style.display = display;
}

用法:

parent window :

<script type="text/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 type="text/javascript" src="ModalDialog.js"></script>
<script type="text/javascript">
function rt(s) {
Dialog.CloseAndReturn(s);
}
</script>

//---------------------------------------

框架页面中,div只能覆盖当前框架,解决方法:在各个框架页面中创建一个div(包括topMenu,leftMenu), 当需要现实dialog时,显示各个框架页面中的div

function showCover() {
            document.getElementById("dCover").style.display = "block";
            window.top.frames[].document.getElementById("dCover").style.display = "block";
        }

ModalDialog.js的更多相关文章

  1. Vue.js——vue-resource全攻略

    概述 上一篇我们介绍了如何将$.ajax和Vue.js结合在一起使用,并实现了一个简单的跨域CURD示例.Vue.js是数据驱动的,这使得我们并不需要直接操作DOM,如果我们不需要使用jQuery的D ...

  2. Vue.js——基于$.ajax实现数据的跨域增删查改

    概述 之前我们学习了Vue.js的一些基础知识,以及如何开发一个组件,然而那些示例的数据都是local的.在实际的应用中,几乎90%的数据是来源于服务端的,前端和服务端之间的数据交互一般是通过ajax ...

  3. Vue.js——60分钟组件快速入门(下篇)

    概述 上一篇我们重点介绍了组件的创建.注册和使用,熟练这几个步骤将有助于深入组件的开发.另外,在子组件中定义props,可以让父组件的数据传递下来,这就好比子组件告诉父组件:"嘿,老哥,我开 ...

  4. JS组件系列——Bootstrap文件上传组件:bootstrap fileinput

    前言:之前的三篇介绍了下bootstrap table的一些常见用法,发现博主对这种扁平化的风格有点着迷了.前两天做一个excel导入的功能,前端使用原始的input type='file'这种标签, ...

  5. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(三):两个Viewmodel搞定增删改查

    前言:之前博主分享过knockoutJS和BootstrapTable的一些基础用法,都是写基础应用,根本谈不上封装,仅仅是避免了html控件的取值和赋值,远远没有将MVVM的精妙展现出来.最近项目打 ...

  6. JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐(二)

    前言:上篇 JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐 分享了几个项目中比较常用的组件,引起了许多园友的关注.这篇还是继续,因为博主觉得还有几个非常简单.实用的组件,实在不愿自己 ...

  7. Vue.js 快速入门

    什么是Vue.js vue是法语中视图的意思,Vue.js是一个轻巧.高性能.可组件化的MVVM库,同时拥有非常容易上手的API.作者是尤雨溪,写下这篇文章时vue.js版本为1.0.7 准备 我推荐 ...

  8. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)

    前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就 ...

  9. JS组件系列——Bootstrap寒冬暖身篇:弹出框和提示框效果以及代码展示

    前言:对于Web开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...

随机推荐

  1. mysql 操作日期函数【增加,减少时间】

    详情链接:http://www.runoob.com/sql/func-date-add.html 定义和用法 DATE_ADD() 函数向日期添加指定的时间间隔. DATE_ADD(date,INT ...

  2. 第三篇 SQL Server安全主体和安全对象

    本篇文章是SQL Server安全系列的第三篇,详细内容请参考原文. 一般来说,你通过给主体分配对象的权限来实现SQL Server上的用户与对象的安全.在这一系列,你会学习在SQL Server实例 ...

  3. MongoDB是?

    MongoDB是? MongoDB是一个基于分布式文件存储的数据库 由C++编写 旨在为 WEB 应用提供可扩展的高性能数据存储解决方案 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当 ...

  4. iOS SQLite 增删改查的封装(关系型)

    在工程里导入libsqlite3.tbd库(Xcode 7) #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder &l ...

  5. TNS-01201: Listener cannot find executablen

    有哥们说,他的数据库监听无法启动,报如下错误: 让其查看一下环境变量是否设置,说设置没问题,但是还是报同样的错误.只好让其截图了: 1.监听文件 2.profile文件 从上面的截图中,可以看出,pr ...

  6. 在Ubuntu 64位OS上运行hadoop2.2.0[重新编译hadoop]

    最近在学习搭建Hadoop, 我们从Apache官方网站直接下载最新版本Hadoop2.2.官方目前是提供了linux32位系统可执行文件,结果运行时发现提示 “libhadoop.so.1.0.0 ...

  7. Java异步IO/NIO

  8. java collections读书笔记(11) Lists

    继续这个系列,好久没学习了,懒惰呀. Set接口,实际上是collection 类别中最简单的一个接口,因为它并没有比Collection 接口增加任何的内容,相对而言,大家可能更喜欢List接口和它 ...

  9. Swift实战-豆瓣电台(八)播放进度与时间

    视频观看地址:http://www.tudou.com/programs/view/4mEtz8S72k0/?resourceId=399000367_06_02_99 这节主要内容是NSTimer, ...

  10. git的基本使用

    1.在本地新建一个文件夹来存放代码 2.用命令行进入这个文件夹 3.git init --来创建一个代码仓库 3. 配置用户信息:用户名和 邮箱(联系作者本人沟通, 责任到人) git config ...