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

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

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

举例说明:

window.location.href、location.href:

例:

 代码如下 复制代码

window.location.href= 'wapsend1.asp?zimu=A&rev= '   +   form1.rev.value ;

parent.location.href:C页面跳转

例:

 代码如下 复制代码

window.parent.parent.location.href=“你定义要跳转的页面”

top.location.href:A页面跳转

例:

在form提交表单的时候有个属性可能对上面的(2)的情况有用target=_top

 代码如下 复制代码

<form name=loginForm action=Login.action method=post target=_top>

</form>

例2

 代码如下 复制代码

echo <iframe width=0 height=0 frameborder=0 scrolling=auto src='登录论坛' onload='reurl()'></iframe>;
echo <script> function reurl(){top.location.href='.$url.'}</script>;

也可以直接在表单提交是的target加个即可

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

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

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

---------------------

本文来自 z18842589113 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/z18842589113/article/details/53316287?utm_source=copy

js中top.location.href、parent.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.location.href,location.href,parent.location.href,top.location.href用法

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

  5. js中哈希表的几种用法总结

    本篇文章只要是对js中哈希表的几种用法进行了总结介绍,需要的朋友可以过来参考下,希望对大家有所帮助 1. <html> <head> <script type=" ...

  6. js中innerHTML、outerHTML与innerText的用法与区别

    ____________________________________________________________________________________________________ ...

  7. js中return false,return,return true的用法及区别

    首先return作为返回关键字,他有以下两种返回方式 1.返回控制与函数结果 语法为:return 表达式; 语句结束函数执行,返回调用函数,而且把表达式的值作为函数的结果 2.返回控制无函数结果 语 ...

  8. JS中的call、apply、bind 用法解疑

    JS中的caller  arguments.callee  call  apply  bind方法 一.call()和apply()方法 1.方法定义 call方法: 语法:call([thisObj ...

  9. JS 中document.URL 和 window.location.href 的区别

    实际上,document 和 window 这两个对象的区别已经包含了这个问题的答案. document 表示的是一个文档对象,window 表示一个窗口对象. 一个窗口下面可以有很多的documen ...

随机推荐

  1. 【转】如何在html与delphi间交互代码

    [转]如何在html与delphi间交互代码 (2015-11-19 22:16:24) 转载▼ 标签: it 分类: uniGUI uniGUI总群中台中cmj朋友为我们总结了如下内容,对于利用de ...

  2. LINQ 学习路程 -- 开篇

    Enumerable: Queryable:

  3. POJ 3928 Ping pong(树状数组+两次)

    题意:每个人都有一个独特的排名(数字大小)与独特的位置(从前往后一条线上),求满足排名在两者之间并且位置也在两者之间的三元组的个数 思路:单去枚举哪些数字在两者之间只能用O(n^3)时间太高,但是可以 ...

  4. Build Antlr4 projects with eclipse java project template.

    from:https://shijinglu.wordpress.com/2015/01/22/build-antlr4-projects-with-eclipse-java-project-temp ...

  5. jquery插件之jquery.extend和jquery.fn.extend的区别

    jquery.extend jquery.extend(),是拓展jquery这个类,即可以看作是jquery这个类本身的静态方法,例如: <!DOCTYPE html> <html ...

  6. 原生js图片懒加载特效

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 1115. Counting Nodes in a BST (30)

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  8. CSS之EM相对单位

    之前以为em单位只是在font-size中起到继承作用, 后来慢慢觉得,继承,应该是在几乎所有样式中都可以是实现的,比如height,width,border... 今天才简单测试了下,果真是可以实现 ...

  9. scrollspy.js--bug

    /** * 20140505 14.33 ycx * scrollspy.js中存在的bug!!!---为什么ui.tabs必须在scrollspy.js中的window.onload之前执行,也就是 ...

  10. Maven(3)-利用intellij idea创建maven web项目

    本文通过一个例子来介绍利用maven来构建一个web项目.开发工具:intellij idea. 一.新建maven项目 此处选择:Create from archetype.表示从已有的maven模 ...