ModalDialog.js
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的更多相关文章
- Vue.js——vue-resource全攻略
概述 上一篇我们介绍了如何将$.ajax和Vue.js结合在一起使用,并实现了一个简单的跨域CURD示例.Vue.js是数据驱动的,这使得我们并不需要直接操作DOM,如果我们不需要使用jQuery的D ...
- Vue.js——基于$.ajax实现数据的跨域增删查改
概述 之前我们学习了Vue.js的一些基础知识,以及如何开发一个组件,然而那些示例的数据都是local的.在实际的应用中,几乎90%的数据是来源于服务端的,前端和服务端之间的数据交互一般是通过ajax ...
- Vue.js——60分钟组件快速入门(下篇)
概述 上一篇我们重点介绍了组件的创建.注册和使用,熟练这几个步骤将有助于深入组件的开发.另外,在子组件中定义props,可以让父组件的数据传递下来,这就好比子组件告诉父组件:"嘿,老哥,我开 ...
- JS组件系列——Bootstrap文件上传组件:bootstrap fileinput
前言:之前的三篇介绍了下bootstrap table的一些常见用法,发现博主对这种扁平化的风格有点着迷了.前两天做一个excel导入的功能,前端使用原始的input type='file'这种标签, ...
- JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(三):两个Viewmodel搞定增删改查
前言:之前博主分享过knockoutJS和BootstrapTable的一些基础用法,都是写基础应用,根本谈不上封装,仅仅是避免了html控件的取值和赋值,远远没有将MVVM的精妙展现出来.最近项目打 ...
- JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐(二)
前言:上篇 JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐 分享了几个项目中比较常用的组件,引起了许多园友的关注.这篇还是继续,因为博主觉得还有几个非常简单.实用的组件,实在不愿自己 ...
- Vue.js 快速入门
什么是Vue.js vue是法语中视图的意思,Vue.js是一个轻巧.高性能.可组件化的MVVM库,同时拥有非常容易上手的API.作者是尤雨溪,写下这篇文章时vue.js版本为1.0.7 准备 我推荐 ...
- JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)
前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就 ...
- JS组件系列——Bootstrap寒冬暖身篇:弹出框和提示框效果以及代码展示
前言:对于Web开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...
随机推荐
- 程序设计: 猫大叫一声,所有的老鼠都开始逃跑,主人被惊醒。(C#语言)
要求: 1.要有联动性,老鼠和主人的行为是被动的. 2.考虑可扩展性,猫的叫声可能引起其他联动效应. 我么能事件来一步一步来实现: 将要执行的老鼠逃跑,和主人惊醒的行为注册到事件中,猫叫之后引发事 ...
- SSH项目练习的时候报错:[applicationContext.xml]: Invocation of init method failed;
这里是控制台的报错信息:org.springframework.beans.factory.BeanCreationException: Error creating bean with name ' ...
- 10月26日 奥威Power-BI基于微软示例库(MSOLAP)快速制作管理驾驶舱 腾讯课堂开课啦
本次课是基于olap数据源的案例实操课,以微软olap示例库Adventure Works为数据基础. AdventureWorks示例数据库为一家虚拟公司的数据,公司背景为大型跨国生产 ...
- Android APP开发笔记
环境搭建 windows系统上需要以下软件: android SDK -- app开发工具包, 开发运行环境(包括SDK管理工具,和虚拟设备管理). JDK -- java 开发工具包, 负责app代 ...
- svn合并
1.先去 aone里我的变更 里 重建 新分支 相当于重主干上拉代码下来2.然后再去 原来的分支里 swich切换到新分支3.在原来的分支里 merge 到新分支的url4.选择最早的 version ...
- linux:lnmp环境搭建
一.准备工作(把安装环境需要使用到的包都下载好) mysql(官网):http://dev.mysql.com/downloads/ php(官网):http://php.net/downloads. ...
- Troubleshooting JDK
收集整理下JDK自带的关于 Troubleshooting 的文档 Java 2 Platform, Standard Edition 5.0 Troubleshooting and Diagnost ...
- Leetcode: Elimination Game
There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number ...
- Ubuntu 16.04 LTS Final Beta about JAVA
我们知道Ubuntu里可能会事先安装了openjdk.但是我习惯于Oracle jdk. ## < 卸载 openjdk > successfully: ### Terminal comm ...
- iOS 检查版本号的代码
- (void)checkNewVersion{ if ([@"appStore" isEqualToString:CHANNEL]) { AFHTTPRequestOperati ...