location.href、parent.location.href、top.location.href、 window.open实现页面跳转

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

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

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

//举个例子:如果A,B,C,D都是htmlDCiframeCBiframeBAiframe,如果Djs这样写

         

window.open("Url地址","_blank") = window.open("Url地址");//在新窗口打开   

         

location = window.location = location.href = window.location.href =self.location.href = "Url地址";//D页面实现展现

window.open("Url地址","_self");//D页面实现展现

         

         

parent.location.href = window.parent.location.href ="Url地址";//C页面实现展现

window.open("Url地址","_parent");//C页面实现展现

         

         

top.location.href = window.top.location.href ="Url地址";//A页面实现展现

window.open("Url地址","_top")//A页面实现展现

         

         

parent.parent.location = "Url地址";//B页面实现展现

 parent.open("Url地址","_parent") = parent.parent.open("Url地址","_self")//B页面实现展现
 
如果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页面刷新
 
 

阅读更多
文章标签: url iframe c html
个人分类: javascript
上一篇js实现页面的跳转
下一篇corejava 面向对象
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭