父窗口:
<script type="text/javascript">
function f1(){
window.showModalDialog("h2.html",window,'dialogHeight:400px;dialogWidth:750px;status=off;scroll=yes;resizeable=yes;');
}
function f2(){
alert('parent window');
}
</script>
<input type="button" onclick='f1()'>
h2.html
<body>
<table><tr><td>
<input type="button" onclick='javascript:window.dialogArguments.f2()'>
</td></tr></table>
</body>
使用了showModalDialog,就不能使用parent以及top等的一些参数作为回调的途径,需要回调关键在于要在子页面上回调时使用
window.dialogArguments
测试过,直接使用this.returnValue返回一个父窗口接受的值只对字符串生效,而是用到数组或是对象时不成功,因此才改用回调函数实现。
网上找到一些资料是可以返回对象的,只可惜偶失败了。有待考究。
分享到:
相关推荐
javascript中showModalDialog子页面值赋给父页面 并解析json格式的值
NULL 博文链接:https://hongan.iteye.com/blog/287050
Javascript 两个窗体之间传值实现代码javascript中还有一个函数window.showModalDialog也可以打开一个新窗体,不过他打开的是一个模态窗口,那么如何在父窗体和子窗体之间传值呢?我们先看该函数的定义:...
window.showModalDialog&&open.docx
javascript函数的解释,解释了具体函数的功能,一、函数JavaScript函数集合 1.document.write(""); 输出语句 2.JS中的注释为// 3.传统的HTML文档顺序是:document->html->(head,body) 4.一个浏览器窗口中的DOM顺序是:...
1. 标准的方法 代码如下: [removed] function openWin(src, width, height, showScroll){ window.showModalDialog (src,””,”location:No;status:No;help:No;dialogWidth:”+width+”;dialogHeight:”+height+”;...
This is a `window.showModalDialog()` shim using a modal HTML5 `<dialog>` element and ECMAScript 6 Generators. It was tested in the latest Google Chrome with the *Enable Experimental JavaScript* flag ...
javascript showModalDialog传值与FireFox的window.open 父子窗口传值示例代码。
在页面中使用了showModalDialog,但是在跳转链接时,不会在当前页执行,而是弹出一个新的页面。
关于struts2里用javascript刷新window.showModalDialog的父页面
javascript 多层模态窗口showModalDialog页面提交及刷新
主要介绍了JavaScript中window.showModalDialog()用法详解,需要的朋友可以参考下
javascript代码模块之\Window.ShowModalDialog使用手册
div层实现showModalDialog
javascript代码模块之如何使用showModalDialog
showModalDialog使用例子,父窗口向子窗口传递值,子窗口设置父窗口的值,子窗口关闭的时候返回值到父窗口 纯js 应用广泛 应用广泛
showModalDialog,open取得父窗口的代码,需要的朋友可以参考下。
showModalDialog参数传递和获
ShowModalDialog函数的功能: 使用方法: 参数说明: