`
roming
  • 浏览: 40663 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

window.opener.location.reload() 与 href=href 的区别

阅读更多

window.opener.location.reload()

window.opener.location.href=window.opener.location.href

都是弹出窗口关闭时用来刷新父窗口。

但window.location.Reload 如果有数据提交的动作,会提示是否提交的(是和否选项)

window.opener.location.href=window.opener.location.href 是定向url提交数据,则不会出现是和否的选择框。


 注意: window.opener.location.href 只是一个链接,如果想实现父窗口的提交就要调用window.opener.action="" 和window.opener.submit();方法,但是不幸的是这段代码在firefox下不能运行,解决的办法为在父窗口中写一个提交的 function在子窗口中通过window.opener.functionname()调用。

       通常在使用window.opener的时候要去判断父窗口的状态,如果父窗口被关闭或者更新,就会出错,解决办法是加上如下的验证if(window.opener && !window.opener.closed)

分享到:
评论

相关推荐

    jsp 刷新父页面

    window.opener.location.href = window.opener.location.href 刷新以winodw.showModelDialog()方法打开的窗口 window.parent.dialogArguments.document.execCommand('Refresh'); 或 Response.Write("<script>...

    [removed].reload 刷新使用分析(去对话框)

    使用[removed].reload;...window.opener.location.href=window.opener.location.href; window.opener.location.reload(); 这种写法就不出现那讨厌的对话框啦! 介绍JS实现刷新iframe的方法 <iframe src=”1.ht

    关闭时刷新父窗口两种方法

    window.opener.location.reload()刷新父窗口window.opener.location.reload() 与 window.opener.location.href=window.opener.location.href 都是弹出窗口关闭时用来刷新父窗口。 但[removed].Reload 如果有数据提交...

    JS窗口大全----很全的哦

    //-----------按钮提示框----------// ...window.opener.location.reload();window.close()">返回</a> javaScript:window.location.reload();//返回当前页并刷新 。。。。。。。。。。。。。。。。。。。。

    JS刷新父页面 父窗口

    // 刷新父页面。此段代码放在被弹出的页面 function refreshOpener() { ... if (win.opener) win.opener.location.reload();//或parent.location.reload(); } catch (ex) { } } ......................

    window.open的页面如何刷新(父页面)上层页面

    代码如下: this.ClientScript.RegisterStartupScript(this.GetType(), this.Title, “window.opener.location.reload();alert(‘销帐成功!’);”, true); 主要是这段js代码:window.opener.location.reload...

    子窗体与父窗体传值示例js代码

    //获取父页面 //parent.location.reload(); //刷新父页面 if (parent != null && parent != “undefined”) { window.returnValue = value; //返回值 window.close(); //关闭子页面 } //window.opener.document....

    107个常用javascript语句

    89.window.location.reload()刷新当前页面. 90.window.history.back()返回上一页,window.history.forward()返回下一页,window.history.go(返回第几页,也可以使用访问过的URL) 91.document.write()不换行的输出,...

    javascript函数的解释

    24.指定当前显示链接的位置:window.location.href="URL" 25.取出窗体中的所有表单的数量:document.forms.length 26.关闭文档的输出流:document.close(); 27.字符串追加连接符:+= 28.创建一个文档元素:document....

    JS中表单的使用小结

    使用window.open()弹出的弹出窗口,刷新父窗口 window.opener.location.reload() 使用window.showDialog弹出的模式窗口 window.dialogArguments.location.reload(); 2.javascript弹出窗口的两种实现方式 —下面给...

    JS实现刷新父页面不弹出提示框的方法

    本文实例讲述了JS实现刷新父页面不弹出提示框的方法。分享给大家供大家参考,具体如下: A页面 open方式出 B... window.opener.location.reload(); window.opener = null; window.open('','_self'); window.close

    JavaScript 定时器 SetTimeout之定时刷新窗口和关闭窗口(代码超简单)

    setTimeout("self.location.reload();",5000); //js 定时关闭窗口(ie和FF中测试过) //6秒后自动关闭当前窗口 setTimeout("window.opener=null;window.close()",6000); 下面给大家介绍下javascript定时器使用 使用...

    JS中showModalDialog关闭子窗口刷新主窗口用法详解

    网上找了好长时间 大都是window.opener.location.reload(),等等 都不是我想要的 最后终于发现了一个 想知道的就往下看看吧 showModalDialog和showModelessDialog 一、showModalDialog和showModelessDialog有什么不同...

    js关闭子窗体刷新父窗体实现方法

    代码如下: Code highlighting produced by Actipro CodeHighlighter (freeware)... //使用浏览器刷新功能 window.opener.location.reload(); 使用showModalDialog方法 window.returnValue = ‘refresh’;

    js setTimeout opener的用法示例详解

    opener.closed){ opener.location.reload(true); } setTimeout : 延迟多长时间执行什么方法,具体使用://www.jb51.net/article/35535.htm opener: 指parent表示父窗口,比如一个A页面利用iframe或frame调用B页面,...

    ajax提交整个from表单示例代码

    代码如下: $.ajax( { type : “POST”, url : “<%=request.getContextPath()%>/control/daControlAction_updateEmotecontrol.action”, data : $(“#form1”).serialize(), ... window.opener.location.reload

    JS刷新父窗口的几种方式小结(推荐)

    浮层内嵌iframe及frame集合窗口,刷新父页面的多种方法 [removed] parent.location.reload(); [removed] [removed] ... window.opener.location.reload(); [removed] [removed] window.opener.location.

    javascript刷新父页面的各种方法汇总

    用iframe、弹出子页面刷新父页面iframe ...window.opener.location.reload(); [removed] 子窗口刷新父窗口 [removed] self.opener.location.reload(); [removed] 刷新以open()方法打开的窗口 [removed] win

    JAVASCRIPT下判断IE与FF的比较简单的方式

    但是过程相对复杂一点,当我们只需要一个简单的判断方式时,可以这样做: 代码如下:[removed] if (document.all){ //IE window.dialogArguments.location.reload(); }else{ //FIREFOX opener.location.reload(); } ...

    js实现运行代码需要刷新的解决方法

    现在大多网站都有“运行代码”的功能,搜索吧也很早就实现了这个功能,但最近在做一个项目时,发现有些需要刷新才能看到结果,自己摸索了下,其实解决方法很简单,看如下代码: function ... newwin.location.reload

Global site tag (gtag.js) - Google Analytics