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开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...
随机推荐
- Java Map 按Key排序和按Value排序
Map排序的方式有很多种,这里记录下自己总结的两种比较常用的方式:按键排序(sort by key), 按值排序(sort by value). 1.按键排序 jdk内置的java.util包下的Tr ...
- Power-BI For K3 免费版培训与交流!Q群视频培训,绝对干货!
Power-BI For K3 免费版培训与交流!Q群视频培训,绝对干货!1.产品安装与配置:2.产品使用:3.个性化开发(现场提需求现场开发):4.交流互动.时间:2015-12-03(周四)晚8 ...
- 8、JavaScript深入浅出——数据类型
一.六种数据类型 Javascript是弱类型. 五种原始类型和一种对象类型: number String boolean null undefined Object 二.隐式转换 +与-的运算举例: ...
- mysql修改表名,列名,列类型,添加表列,删除表列
alter table test rename test1; --修改表名 ); --添加表列 alter table test drop column name; --删除表列 ) --修改表列类型 ...
- linux:档案权限
一.例如:-rw-r--r--. 1 root root 129 Dec 29 2013 .tcshrc 详细: 1.-rw-r--r--:档案类型和权限(总共十个栏位) 1.1:第一个栏位代表 ...
- CSS For Bar Graphs(maybe old)
Having a working knowledge of XHTML and CSS when developing applications is a big help in knowing wh ...
- tableview在第一次显示时会自动relodata
tableview在第一次显示时会自动加载数据
- 资源Createwindow,对应标识符,绑定窗口
问? 定义一个CEdit cedit1:怎么和IDC_EDIT1 关联,可以在CEdit.Create()里传进去或者在DoDataExchange()里面绑定,是不是一定要先弄出个IDC_EDIT1 ...
- Python学习总结15:时间模块datetime & time & calendar (二)
二 .datetime模块 1. datetime中常量 1)datetime.MINYEAR,表示datetime所能表示的最小年份,MINYEAR = 1. 2)datetime.MAXYEAR ...
- .NET: C#: Attribute
ref: http://www.uml.org.cn/net/200810135.asp ref: http://blog.csdn.net/okvee/article/details/2610349 ...