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>

  • 相关阅读:
    mvn 创建的项目 导入到eclipse
    maven GroupID和ArtifactID
    eclipse配置maven + 创建maven项目
    微服务简介
    spring-boot5代码
    spring-boot5
    TextView及其子类
    RTMP协议
    实现输出h264直播流的rtmp服务器
    Android按键事件传递流程(二)
  • 原文地址:https://www.cnblogs.com/cdaq/p/3921574.html
Copyright © 2011-2022 走看看