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. php 扩展dll

    一.准备工作: 注:php5.2没有vc9,php5.3.php5.4没有vc6.呵呵.PHP5.5开始,不支持xp和win2003了,更是vc11了.--------------->所以,扩展 ...

  2. C# DEV--CharControl

    使用DEV的图表控件CharControl,代码如下: try { //声明折线 XYDiagram Diagram = chartControl1.Diagram as XYDiagram; Dia ...

  3. [CC]CC插件初探

    应用程序插件框架的内容包括:主程序App,插件Plugin. 1.实现一个应用程序插架框架关键点有: 一个插件的标准接口,在主程序中存在一个插件的集合.主程序通过循环读取每个插件,将插件对象通过多态的 ...

  4. oracle表空间相关SQL语句

    Oracle 数据库查看表空间的使用情况 SELECT d.tablespace_name, space "SUM_SPACE(MB)", ) "USED_SPACE(M ...

  5. 如何让CRectTracker的m_rect不超出一定的范围,比如screen或者某个document的范围

    最近在尝试做一个QQ截图那样的工具,其中一个功能就是要做一个选择框,自然用到了CRectTracker 但是有一个很关键的东西就是,拖拽CRectTracker的时候,不能让CRectTracker“ ...

  6. 使用NSData处理数据

    // //  main.m //  06-使用NSData处理数据 // //  Created by apple on 14-3-21. //  Copyright (c) 2014年 apple. ...

  7. iOS 图片循环滚动(切片效果)

                             #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIAp ...

  8. SSM框架搭建

    http://blog.csdn.net/gebitan505/article/details/44455235/

  9. .NET: WPF Template

    Data Template: 要做一个listBox,里面有车子的简单信息,点了里面的item后就会显示详细信息. car class: using System; using System.Coll ...

  10. Json lib集成stucts2的使用方法 抛出 NestableRuntimeException异常的解决办法

    首先贴出struts 2.3.16需要导入的包 因为使用的是2.3 版本,必须要导入这个包,否则会报java.lang.NoClassDefFoundError: org/apache/commons ...