在java web在编程中我们有时也要知道javascript在知识,在此我将刷新父窗体的两种方式(window.open()和window.showModalDialog())的javascript写出来供大家参考:
> a.jsp中:window.open('b.jsp')我们可以在b.jsp页面中可以通过window.opener得到a.jsp的window对象再让地址刷新就可以了 --> window.opener.location.reload();
> a.jsp中:window.showModalDialog('b.jsp')我们可以对b.jsp页面的window对象设一个返回值(window.returnValue=1;),然后在a.jsp中得到返回值进行判断,如果正确则可以调用window.location.reload()进行刷新。
a.jsp: var result = window.showModalDialog('b.jsp');if(result ==1) window.location.reload();
b.jsp: window.returnValue=1;
这样就可以达到刷新的效果了。
分享到:
相关推荐
网上找了好几个小时没有找到解决办法。最终还是自己解决了。...这样做就是用超链接把返回url转递到用showModalDialog打开的新窗口中,当showModalDialog返回时指到转来的url,最终不刷新父窗口。......
针对window.showmodaldialog弹出窗体无刷新的详细使用
NULL 博文链接:https://shawnfree.iteye.com/blog/598885
window.showModalDialog以及window.open用法简介
ShowModalDialog函数的功能: 使用方法: 参数说明:
ShowModalDialog父窗体向子窗体传值
showModalDialog和window.open
window.showModalDialog以及window.open用法简介
window.showModalDialog&&open.docx
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 ...
showModalDialog刷新窗口的例子
关于struts2里用javascript刷新window.showModalDialog的父页面
javascript代码模块之\Window.ShowModalDialog使用手册
1> window.showModalDialog()采用JS原理实现,同时父窗口不可操作,window.open()采用新创建一个窗口,同时父窗口可操作; 2> 父窗口与子窗口传递值的方式也有所不同,在子窗口中操作父窗口也语法也不同,分别为var...
使用window.showModalDialog的程序员都知道,该方法可返回值。但是如果遇到跨域时,就返回为underfine。本文档通过iframe镶嵌页面解决该问题。
window.showModalDialog的基本用法
javascript代码模块之window.showModalDialog方法的使用
因为项目中使用showModalDialog函数的地方特别多,所以必须用一个类似方法实现功能,也就是window.open() 首先是判断子窗口关闭,因为项目是在子窗口关闭(确定按钮)的时候向父页面传递值的。