zoukankan      html  css  js  c++  java
  • 模态窗口的运用

    1   在主窗体

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
    function testModalDialog()
    {
    var p = new Object();
    p.name = "chengdong";
    var res = window.showModalDialog("2.html", p);
    alert("返回值" + res);

    }

    </script>
    </head>
    <body>
    <a href="javascript:testModalDialog()">弹出模态窗口</a>
    </body>
    </html>

    2  弹出的窗体

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>我是模态窗体</title>
    <script type="text/javascript">

    var obj = window.dialogArguments;
    alert("你传递的参数是"+obj.name);
    function closeWin()
    {
    window.returnValue = document.getElementById("txtName").value;
    window.close();
    }
    </script>
    </head>
    <body>
    模态窗体赶回值给父窗体
    <input type="text" id="txtName"/>
    <input type="button" value="关闭" onclick="closeWin()" />
    </body>
    </html>

  • 相关阅读:
    Unity3D 学习笔记
    Python中os和sys模块
    合并两个排序的链表
    反转链表 难
    链表中倒数第k个结点
    调整数组顺序使奇数在偶数前 14
    javascript中this详解
    静态方法实例方法
    强制类型转换
    javascript类型判断方法
  • 原文地址:https://www.cnblogs.com/cdaq/p/3921574.html
Copyright © 2011-2022 走看看