`
bluend1004
  • 浏览: 15710 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

关于js中"window.location.href"、"location.href"(转载)

阅读更多
关于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页面刷新



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/suchgoingdown/archive/2009/10/27/4734331.aspx
分享到:
评论

相关推荐

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

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

    关于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;...

    JS 中document.URL 和 windows.location.href 的区别

    document 表示的是一个文档对象,windows ...windows.location.href&#41;; 发现,这两个的值不一样, document.URL : //www.jb51.net/ windows.location.href ://www.jb51.net/#server 所以,如果要用 fragment 进行

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

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

    获得当前页面的url

    window.location.href location.search; //获取url中"?"符后的字串 document.referrer 获取来路的url,相当于php的$_SERVER['HTTP_REFERER']。 encodeURIComponent() 对url进行转定义,相当于php的urlencode()...

    Javascript窗口与提示大全

    Javascript窗口与提示大全 ...onclick="javaScript:window.location.href='http://angelialily.javaeye.com/';"/&gt; //-----------关闭按钮----------// 关闭" onclick="javaScript:window.close();"&gt;

    window.parent与window.openner区别介绍

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

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

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

    JS window.opener返回父页面的应用

    JS代码: window.open(); 而当支付成功后,需要关闭支付平台支付成功界面,并在客户端加载客户端支付成功页面,JS代码: window.opener.location.href=url;window.close();

    基于jquery的浮动提示层

    本人原创,转载请注明。 本代码段基于jquery框架实现背景透明的浮动提示层,这个在做ajax方面时比较常用。... BUG修改,在closeFlLayer函数的修改为如下代码: ... window.location.href=window.location.href; }

    location.href语句与火狐不兼容的问题

    于是我在location前面加了一个 window,即改为: onclick=”[removed].href(‘http://baidu.com’);” 发现仍然不行。 于是去baidu之,找到一个答案: 使用[removed]=”url”; 代替 location.href(‘url’);” 于是...

    jquery thickbox遮罩frameset框架的解决办法(请仔细阅读描述)

    //alert(window.top.location == self.location); if (window.top.location != self.location) { window.top.tb_show(t, a, g); } else { self.tb_show(t, a, g); } this.blur(); return false; }); }

    javascript使用window.name解决跨域问题第1/2页

    window.name 的美妙之处:name 值在不同的页面(甚至不同域名)加载后依旧存在,并且可以支持非常长的 name 值(2MB)。

    js异常捕获

    异常是不可控的,会影响最终的呈现结果,但是我们有充分的理由去做这样的事情。 1. 增强用户体验; 2. 远程定位问题; 3. 未雨绸缪,及早发现问题; 4. 无法复线问题,尤其是移动端,机型,系统都是问题;...

    java 常用开发代码

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

Global site tag (gtag.js) - Google Analytics