"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页面刷新

关于js中window.location.href,location.href,parent.location.href,top.location.href用法的更多相关文章

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

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

  2. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别(跳出iframe方法)

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

  3. 关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法

    关于js中"window.location.href"."location.href"."parent.location.href".&qu ...

  4. 网站开发进阶(二十)JS中window.alert()与alert()的区别

    JS中window.alert()与alert()的区别 前言 alert与window.alert没什么区别,如果有人觉得有区别,那就来解释一下:所有以window.开始的语句,都可以直接把wind ...

  5. 在js中window.open通过“post”传递参数

    在js中window.open通过“post”传递参数的步骤如下: 如:在A.jsp中 有一个js方法 winow.open,目标地址是 xx.do 1.在A.jsp建一个form,把要设置的值通过j ...

  6. js中window.onload 与 jquery中$(document.ready()) 測试

    js中window.onload 与 jquery中$(document.ready())差别,验证代码例如以下(调换js代码和Jquer代码书写顺序測试.执行结果一样.因此与代码书写位置没关系): ...

  7. 关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法

    location.href 和 window.location.href 区别: 1.location.href 可以直接跳转其他地址(不属于本项目) 也可以跳转本项目中的 2.window.loca ...

  8. js中window对象详解以及页面跳转

    1.window.top.window.location = "index.asp"; 2.window.top.location.href="index.asp&quo ...

  9. js中Window 对象及其的方法

    window.location 对象 window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面.window.location 对象在编写时可不使用 wind ...

随机推荐

  1. 洛谷 U4704 函数

    设gcd(a,b)为a和b的最大公约数,xor(a,b)为a异或b的结果. 题目描述 kkk总是把gcd写成xor.今天数学考试恰好出到了gcd(a,b)=?这样的题目,但是kkk全部理解成了xor( ...

  2. 一个完整的ant build.xml

    <?xml version="1.0" encoding="UTF-8"?> <project name="genwar" ...

  3. JSDOM优化

    JS操作DOM,就像从一个岛到另外一个岛,过桥的时候,每次都要收取过桥费,尽量减少过桥的次数.列如:   for循环插入到页面5000个LI:  应该 先用一个变量存 5000个li,然后一次插入. ...

  4. IFeatureLayer

      All Properties Methods Inherited Non-inherited Description AreaOfInterest The default area of inte ...

  5. ural1470 UFOs

    UFOs Time limit: 2.0 secondMemory limit: 64 MB Vasya is a ufologist and his duties include observing ...

  6. ExtJS如何取得GridPanel当前选择行数据对象 - nuccch的专栏 - 博客频道 - CSDN.NET

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  7. 解决IntelliJ IDEA 创建Maven项目速度慢问题 DarchetypeCatalog

    原因 IDEA根据maven archetype的本质,其实是执行mvn archetype:generate命令,该命令执行时,需要指定一个archetype-catalog.xml文件. 该命令的 ...

  8. jQuery插件实现的方法和原理简单说明

    下文来自 http://www.itzhai.com/jquery-plug-ins-to-achieve-the-methods-and-principles-of-simple-instructi ...

  9. Nginx http_user_agent 防御 ab 等

    日志出现大量: xxxxxxxxxxxxx - - [04/Jul/2013:23:37:49 +0800] "GET /1000.html HTTP/1.0" 200 56471 ...

  10. Kconfig基本语法

    Linux 内核在2.6版本以后将配置文件由原来的config.in改为Kconfig.当执行make menuconfig时会出现内核的配置界面,所有配置工具都是通过读取arch/$(ARCH)Kc ...