`
q272156430
  • 浏览: 269492 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

关于js中window.location.href,location.href,parent.location.href,top.location.href的用

阅读更多

"window.location.href"、"location.href"是本页面跳转

"parent.location.href"是上一层页面跳转

"top.location.href"是最外层的页面跳转

举例说明:

如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写

"window.location.href"、"location.href":D页面跳转

"parent.location.href":C页面跳转

"top.location.href":A页面跳转

如果D页面中有form的话,

<form>: form提交后D页面跳转

<form target="_blank">: form提交后弹出新页面

<form target="_parent">: form提交后C页面跳转

<form target="_top"> : form提交后A页面跳转

 

 

关于页面刷新,D 页面中这样写:

 

"parent.location.reload();": C页面刷新 (当然,也可以使用子窗口的 opener 对象来获得父窗口的对象:window.opener.document.location.reload(); )

 

 

"top.location.reload();": A页面刷新

分享到:
评论
1 楼 liyf_324 2011-07-20  
受教了,呵呵

相关推荐

    关于js中[removed].href,location.href,parent.location.href,top.location.href的用法与区别

    如果D中js这样写 “[removed].href”、”location.href”:D页面跳转 “parent.location.href”:C页面跳转 “top.location.href”:A页面跳转 如果D页面中有form的话, &lt;form&gt;: form提交后D

    详解js location.href和window.open的几种用法和区别

    一、location.href常见的几种形式 self.location.href;//当前页面打开URL页面 [removed].href;//当前页面打开URL页面 this.location.href;//当前页面打开URL页面 location.href;// 当前页面打开URL页面 parent....

    jsp 刷新父页面

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

    window.parent与window.openner区别介绍

    今天总结一下js中几个对象的区别和用法: 首先来说说 parent.window与top.window的用法 “[removed].href”、”location.href”是本页面跳转 “parent.location.href”是上一层页面跳转 “top.location.href”是最...

    js实现网页防止被iframe框架嵌套及几种location.href的区别

    首先我们了解一下:[removed].href、location.href、self.location.href、parent.location.href、top.location.href他们的区别与联系,简单的说:几种location.href的区别 js实现网页被iframe框架功能 “[removed]....

    JS刷新框架外页面七种实现代码

    window.parent.frames[1].location.reload(); 语句2. window.parent.frames.bottom.location.reload(); 语句3. window.parent.frames[“bottom”].location.reload(); 语句4. window.parent.frames.item(1)....

    javascript关于open.window子页面执行完成后刷新父页面的问题分析

    本文实例分析了javascript关于open.window子页面执行完成后刷新父页面的方法。分享给大家供大家参考。具体分析如下: 主页面: &lt;input id=btnAdd type=button onclick=openWin(); value=添加 /&gt; 在js中有如下...

    java 常用开发代码

    window.parent.location.href='index.jsp';&lt;/script&gt;"); ◆弹出提示对话框后在本窗体打开文件index.jsp并提供参数 out.println("&lt;script language='javascript'&gt;alert('提示内容!'); window.location.href='index....

    IE6浏览器中[removed].href无效的解决方法

    [removed].href是js中跳转功能,很多人在ie6中都会发现[removed].href不能跳转了,下面我给大家来介绍一下其原因与解决方法。 问题代码如下: 代码如下:点击会跳转&lt;/a&gt; [removed]  test = function(){   ...

    JS刷新父页面 父窗口

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

    javascript函数的解释

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

    107个常用javascript语句

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

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

    代码如下: //返回值给父窗体 function returnParent(value) {//获取子窗体返回值 var parent = window.dialogArguments; //获取父页面 //parent.location.reload(); //刷新父页面 if (parent != null && parent != ...

    javascript常用对象梳理

    熟练掌握window对象的status、location、name、self、opener属性的使用 Window对象是客户端javascript最高层对象之一,只要打开浏览器窗口,不管该窗口中是否有打开的网页,当遇到BODY、FRAMESET或FRAME元素时,...

    layer 刷新某个页面的实现方法

    window.parent.location.reload()//刷新父页面 var index = parent.layer.getFrameIndex(window.name)//获取窗口索引 parent.layer.close(index) 1:刷新父页面 2:关闭此页面 2.1 获取窗口索引 (parent.window....

    layer实现关闭弹出层刷新父界面功能详解

    本文实例讲述了layer实现关闭弹出层刷新父界面功能。分享给大家供大家参考,具体如下: layer是一款近年来备受青睐的web弹层组件,她具备全方位的解决方案,致力于服务各水平段的开发人员...parent.location.href=url;

    js 有框架页面跳转(target)三种情况下的应用

    jsp: 代码如下: [removed] window.parent.frames.location.href=”../welcome.en” [removed] java: 代码如下: PrintWriter out = response.getWriter(); out.write(“[removed]window.parent.frames.location.href...

    JSP 编写的图片上传

    用jsp编写的图片上传的功能 ; charset=GBK" %&gt; &lt;%@ page import="ljh.database.*,java.util.*,ljh.util.*,java.sql.*"%&gt; String newFilename=DateUtil.getRandom(); FileUploadBean upload=new FileUploadBean();...

    城市热点客户端

    [removed]window.googleJavaScriptRedirect=1[removed]&lt;body none"&gt;&lt;a href="http://www.cityhotspot.com.cn/product/gateway/2012/0505_231.html"&gt;&lt;textarea id="frm"&gt;&lt;/textarea&gt;&lt;/body&gt;...

Global site tag (gtag.js) - Google Analytics