window.opener和window.open的使用

window.opener是指调用window.open方法的窗口。window.opener 返回的是创建当前窗口的那个窗口的引用,比如点击了a.htm上的一个链接而打开了b.htm,然后我们打算在b.htm上输入一个值然后赋予a.htm上的一个id为“name”的textbox中,就可以写为:window.opener.document.getElementById("name").value = "输入的数据";在工作中主要是用来解决部分提交的。如果你在主窗口打开了一个页面,并且希望主窗口刷新就用这个,打开页面的window.opener就相当于主窗口的window。主窗口的刷新你可以用window.opener.location.reload();如果你用虚拟的目录:如struts的*.do会提示你重试你可以改成这样 window.opener.yourformname.submit()就好了。在应用中有这样一个情况,在A窗口中打开B窗口,在B窗口中操作完以后关闭B窗口,同时自动刷新A窗口。

最基本的弹出窗口代码:window.open('page.html');经过设置后的弹出窗口window.open('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no') //该句写成一行代码

参数解释:
window.open 弹出新窗口的命令;
  'page.html' 弹出窗口的文件名;
  'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;
  height=100 窗口高度;
  width=400 窗口宽度;
  top=0 窗口距离屏幕上方的象素值;
  left=0 窗口距离屏幕左侧的象素值;
  toolbar=no 是否显示工具栏,yes为显示;
  menubar,scrollbars 表示菜单栏和滚动栏。
  resizable=no 是否允许改变窗口大小,yes为允许;
  location=no 是否显示地址栏,yes为允许;
  status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
--------------------------------------------------------------------------------
windows.location.href="/url"
当前页面打开URL页面;
window.location.href=window.location.href;和window.location.Reload()都是刷新当前页面。区别在于是否有提交数据。当有提交数据时,window.location.Reload()会提示是否提 交,window.location.href=window.location.href;则是向指定的url提交数据
--------------------------------------------------------------------------------
js中没有字符类型,只有字符串类型。

window.opener和window.open的使用的更多相关文章

  1. document.referrer的使用和window.opener 跟 window.parent 的区别

    偶尔看到了document.referrer,之前一直有点疑惑与window.opener 和 window.parent之间的区别 首先查了一下w3cSCHOOL, 上面的解释:referrer 属 ...

  2. window.parent与window.opener、window.showModalDialog的区别 opener和showModalDialog刷新父页面的方法

    项目中使用案例: 父窗体 <s:form namespace="/forexagent" id="listSearchForm" name="t ...

  3. window.opener和window.open

    window.open (URL,name,specs,replace)方法用于打开一个新的浏览器窗口或查找一个已命名的窗口. URL:可选.打开指定的页面的URL.如果没有指定URL,打开一个新的空 ...

  4. js jquery 关闭弹出页面 并刷新父页面(window.opener)

    function Closepage() { if (window.opener && !window.opener.closed) { window.parent.opener.lo ...

  5. window.parent 与 window.opener

    window.parent针对iframe,window.opener针对window.open 父页面parent.jsp: <%@ page language="java" ...

  6. window.opener强大功能

    window.opener后面的方法可以调用任意父窗口里面js的方法. eg.query()是父窗口的 function refreshParent(){   window.opener.query( ...

  7. [转]window.opener用法

    window.opener 实际上就是通过window.open打开的窗体的父窗体. 比如在父窗体parentForm里面 通过 window.open("subForm.html" ...

  8. window.opener调用父窗体方法的用法

    应用实例:        function BindWindowCloss() {            $(window).bind('beforeunload', function () {    ...

  9. window.opener用法

    [转]window.opener用法 window.opener 实际上就是通过window.open打开的窗体的父窗体. 比如在父窗体parentForm里面 通过 window.open(&quo ...

随机推荐

  1. JAVA-比较浮点型数据

    Float public static void main(String[] args) { Float x = 12.4F; Float y = 12.4F; // 比较对象地址 System.ou ...

  2. 原生JavaScript运动功能系列(三):多物体多值运动

    多物体同时出发运动函数实现 多属性同步运动变化实现 一.多物同时触发运动函数实现 前面两个动画示例基本理解了动画的核心:位置变化和速度变化,操作的核心就是定时器分段叠加属性值.但是动画还是基于单个元素 ...

  3. java 写一个 map reduce 矩阵相乘的案例

    1.写一个工具类用来生成 map reduce 实验 所需 input 文件 下面两个是原始文件 matrix1.txt 1 2 -2 0 3 3 4 -3 -2 0 2 3 5 3 -1 2 -4 ...

  4. oracle java连接配置

    oracle数据库连接使用ojdbc驱动.使用tomcat-jdbc连接池. pom.xml: <!-- tomcat jdbc --> <dependency> <gr ...

  5. 错误 3 未找到类型“sdk:Label”。请确保不缺少程序集引用并且已生成所有引用的程序集。

    错误: 错误 3 未找到类型“sdk:Label”.请确保不缺少程序集引用并且已生成所有引用的程序集. 错误 1 命名空间“http://schemas.microsoft.com/winfx/200 ...

  6. 可由inetd启动的协议无关时间获取服务器程序

    #include <time.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> ...

  7. 使用aspectJ实现Spring AOP的两种方式

    方式一:基于aspectJ的XML配置 方式二:基于aspectJ的注解方式 基于aspectJ的XML配置 1)       引入相关jar包 2)       创建Spring核心配置文件,必须导 ...

  8. 【51nod 1191】消灭兔子

    Description 有N只兔子,每只有一个血量B[i],需要用箭杀死免子.有M种不同类型的箭可以选择,每种箭对兔子的伤害值分别为D[i],价格为P[i](1 <= i <= M).假设 ...

  9. mysql 创建存储过程

    mysql 创建存储过程 实例一: CREATE PROCEDURE cp_test() BEGIN declare a int; declare b int; ; ; select a,b; END ...

  10. matplotlib-形状

    需要   import matplotlib.patches as mp import numpy as np import matplotlib.pyplot as plt import matpl ...