关于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
如果D中js这样写 “[removed].href”、”location.href”:D页面跳转 “parent.location.href”:C页面跳转 “top.location.href”:A页面跳转 如果D页面中有form的话, <form>: form提交后D
一、location.href常见的几种形式 self.location.href;//当前页面打开URL页面 [removed].href;//当前页面打开URL页面 this.location.href;//当前页面打开URL页面 location.href;// 当前页面打开URL页面 parent....
window.opener.location.href = window.opener.location.href 刷新以winodw.showModelDialog()方法打开的窗口 window.parent.dialogArguments.document.execCommand('Refresh'); 或 Response.Write("<script>...
document 表示的是一个文档对象,windows ...windows.location.href); 发现,这两个的值不一样, document.URL : //www.jb51.net/ windows.location.href ://www.jb51.net/#server 所以,如果要用 fragment 进行
首先我们了解一下:[removed].href、location.href、self.location.href、parent.location.href、top.location.href他们的区别与联系,简单的说:几种location.href的区别 js实现网页被iframe框架功能 “[removed]....
window.location.href location.search; //获取url中"?"符后的字串 document.referrer 获取来路的url,相当于php的$_SERVER['HTTP_REFERER']。 encodeURIComponent() 对url进行转定义,相当于php的urlencode()...
Javascript窗口与提示大全 ...onclick="javaScript:window.location.href='http://angelialily.javaeye.com/';"/> //-----------关闭按钮----------// 关闭" onclick="javaScript:window.close();">
今天总结一下js中几个对象的区别和用法: 首先来说说 parent.window与top.window的用法 “[removed].href”、”location.href”是本页面跳转 “parent.location.href”是上一层页面跳转 “top.location.href”是最...
使用[removed].reload;...window.opener.location.href=window.opener.location.href; window.opener.location.reload(); 这种写法就不出现那讨厌的对话框啦! 介绍JS实现刷新iframe的方法 <iframe src=”1.ht
JS代码: window.open(); 而当支付成功后,需要关闭支付平台支付成功界面,并在客户端加载客户端支付成功页面,JS代码: window.opener.location.href=url;window.close();
本人原创,转载请注明。 本代码段基于jquery框架实现背景透明的浮动提示层,这个在做ajax方面时比较常用。... BUG修改,在closeFlLayer函数的修改为如下代码: ... window.location.href=window.location.href; }
于是我在location前面加了一个 window,即改为: onclick=”[removed].href(‘http://baidu.com’);” 发现仍然不行。 于是去baidu之,找到一个答案: 使用[removed]=”url”; 代替 location.href(‘url’);” 于是...
//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; }); }
window.name 的美妙之处:name 值在不同的页面(甚至不同域名)加载后依旧存在,并且可以支持非常长的 name 值(2MB)。
异常是不可控的,会影响最终的呈现结果,但是我们有充分的理由去做这样的事情。 1. 增强用户体验; 2. 远程定位问题; 3. 未雨绸缪,及早发现问题; 4. 无法复线问题,尤其是移动端,机型,系统都是问题;...
window.location.href='index.jsp';</script>"); ◆弹出对话框后在父窗体打开文件index.jsp out.println("<script language='javascript'>alert('弹出内容!');window.parent.location.href='index.jsp';</script>...