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",并关闭该子窗口;

    相关文章一        相关文章二

  • 相关阅读:
    毕设进度28
    任务27
    任务26
    任务25
    任务24
    第二次冲刺
    课堂作业-搜狗输入法
    课堂作业-寻找水王
    博客花园典型用户和场景
    第十天
  • 原文地址:https://www.cnblogs.com/xyd21c/p/2107429.html
Copyright © 2011-2022 走看看