zoukankan      html  css  js  c++  java
  • js弹窗返回值详解(window.open方式)

    今天在改公司一个老系统时,碰到了window.open()的这个语法。虽然这个方法有点老,不太用了。所以有点不清楚父级弹框如何获取子级页面返回的值。为了解决这个问题,上网搜了一下。原作者参考网址:http://blog.csdn.net/xmwangtiger/article/details/4234054

    这里重点总结一下啊!

    语法:window.open("sUrl","sName","sFeature","bReplace"); 

    使用:1:  在父级页面 test.aspx 的点击<input type="button" id="btnShow" onclick="showItem();"  value="显示子窗体"/>按钮触发 ,然后 :

      <script language="javascript" type="text/javascript">
       function showItem() {

             var  win = window.open("test2.aspx",null," height=300,width=450,  Left=300px,Top=20px, menubar=no,titlebar=no,scrollbar=no,toolbar=no, status=no,location=no");

      }

      2: 在子级页面test2.aspx的点击<input type="button" id="btnSelect" onclick="check();"  value="选择"/> 按钮触发,然后:

        <script language="javascript" type="text/javascript">
       function check() {

              window.opener.document.getElementById("txtId").value=id;
              window.opener.document.getElementById("txtName").value=name;

      }

      这样,父级页面的document.getElementById("txtId") 和 document.getElementById("txtName") 2个控件就可以得到子级页面的返回值。

  • 相关阅读:
    [转]老男孩读pcie
    nand
    面试题目汇总
    redis的tcp-backlog配置
    Redis 3.0.4 sentinels
    Redis 3.0.4 客户端
    Redis 3.0.4 事件驱动
    Redis 3.0.4 AOF持久化
    Redis 3.0.4 数据库
    Redis 3.0.4 RDB持久化
  • 原文地址:https://www.cnblogs.com/shj-com/p/8251301.html
Copyright © 2011-2022 走看看