zoukankan      html  css  js  c++  java
  • 弹出窗口window.open window.showModalDialog

    window.open

    使用window.open弹出子窗口后,子窗口可通过window.opener来操作父窗口。

    如:

    window.opener.location.href="parent.html";//设置父窗口页面地址

    window.opener.location.reload();//刷新父窗口

    window.opener.document.getElementById("test").value="test";//设置父窗口控件的值

    window.opener.document.montherform.元素ID.value="test";//设置父窗口中父表单元素的值

    window.opener.close();//关闭父窗口

    window.showModalDialog

    使用window.showModalDialog弹出子(模式)窗口后,必须关闭该子窗口才能手动操作父窗口,子窗口可通过window.dialogArguments来获取父窗口元素。

    window.parent.parent.close();//IE浏览器下关闭当前(子)窗口

    window.dialogArguments.location.reload();//刷新父窗口;

    在父页面中通过定义变量获取子窗口返回的值:

    var rtVal = window.showModalDialog("","");

    showModalDialog打开的子窗口中:

    window.returnValue = a;window.close();//设定返回父窗口的值为"a",并关闭该子窗口;

    相关文章一        相关文章二

  • 相关阅读:
    7.微软AJAX的解决方案
    6.投票系统
    5.JSON
    4.无刷新评论
    3.输入商品名称后自动弹出其价格示例
    2.JQuery AJAX
    1.AJAX简介
    网站优化
    防抖和节流
    在地址栏输入一次地址会发生什么
  • 原文地址:https://www.cnblogs.com/xyd21c/p/2107429.html
Copyright © 2011-2022 走看看