window.showModalDialog( url, window ); 然后在弹开窗口中:
window.dialogArguments 即为父窗口window对象的引用。想搞什么都可以了。
window.dialogArguments 即为父窗口window对象的引用。想搞什么都可以了。
解决方案 »
- 表头浮动时,表头跟数据行对不齐
- 求助!!html页面采用js发email实例
- 新手求助: 下面的 代码 代表什么,看不懂
- js中有集合类型吗?
- 请问这样的赋值为什么为一直报错搞不定呢?:“ cell.innerHTML="<input onclick='function(20,'就是这里');'>"; ”
- 关于onunload问题~~~急
- [求助]这样的一个动态添加input的功能怎么实现
- javascript中如何定时更改网页背景图片?
- 怎样处理这样的多选啊?
- JQ轮播图怎么让每张图加不同的超链接
- 请问动态增加的table 如何设置满足条件的row 的字体颜色为红色?
- 帮我理解下 callee,谢谢各位
父窗口中弹出时这么写:window.showModalDialog('子窗口.aspx',window,'....');
注意第二个参数用window,这样你就把父窗口对象当做参数传递给了子窗口.
然后在子窗口中就可以通过window.dialogArguments来引用父窗口对象了.
就向楼上说的,你想怎么搞都行了...
举个例子,你可以在子窗体关闭的时候刷新父窗体,可以这么写:
window.dialogArguments.location.href=window.dialogArguments.location.href;
window.focus();
window.close();
你也可以调用主窗口里的函数:
window.dialogArguments.函数名();
1.htm
===========
<title>1</title>
<input type=button value="open 2" onclick="window.showModalDialog('2.htm',window);">
<script>
alert("1")
</script>
2.htm
===========
<title>2</title>
<frameset cols="0,*">
<frame src="">
<frame src="b.htm">
</frameset>b.htm
==========
<input type=button value="open 3" onclick="window.showModalDialog('3.htm',window);">
<script>
alert("我是2")
</script>
3.htm
=========
<title>3</title>
<frameset cols="0,*">
<frame src="">
<frame src="c.htm" name="x">
</frameset>
c.htm
=====
<input type="button" value="refresh 2 and close me" onclick="window.dialogArguments.location='2.htm';window.parent.close()">
注意:showModalDialog缓存的厉害,请清空缓存每次测试