zoukankan      html  css  js  c++  java
  • bootstrap:modal & iframe

    form提交绑定到特定的iframe & form的结果在dialog上显示

    form:target属性

    <!-- when the form is submitted, the server response will appear in this iframe -->
    <form asp-controller="****" asp-action="****" method="post" id="batchClose" target="my_iframe">
        <input id="param1" type="text" name="param1" style="display:none">
        <input id="param2" type="text" name="param2" style="display:none">
    </form>
    

      

    modal显示iframe

    <div id="BatchCloseAccountM" class="modal" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">确认账单</h5>
                </div>
                <div class="modal-body">
                    <iframe class="my_iframe" name="my_iframe" src="" frameborder="0" scrolling="no" style="height:110px;400px"></iframe>
                </div>
                <div class="modal-footer">
                    <button name="cancel" type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
    

      

    绑定js事件

    <script type="text/javascript">
            function BatchClose_method() {
                iframe_init();
                $("#parm1").val(2);
                $("#parm2").val(201902);
                $("#batchClose").submit();
                $("#BatchCloseAccountM").modal('show');
            }
            function iframe_init() {
                $(".my_iframe").contents().find("body").html('<span style="font-size:12px;">加载中。。。 </span>');
            }
            jQuery(function ($) {
                $("#BatchCloseAccountM").on("hidden.bs.modal", function () {
                    alert("页面刷新");
                });
            });
        </script>
    

      

    触发modal

    <a ww-check-acl="~/****/****" href="javascript:void(0);" onclick="BatchClose_method()">确认账单</a>
    

      

  • 相关阅读:
    System.Diagnostics.Process.Start()
    Asp.Net 构架(HttpModule 介绍) Part.3
    Asp.Net 构架(Http Handler 介绍) Part.2
    Asp.Net构架(Http请求处理流程)
    Ruby 2.0 发布首个预览版
    Java基本数据类型及类型转换
    J2EE 1.4 APIs and Technologies
    java final 关键字
    Android获取通讯录
    Activity的四种加载模式(转载)
  • 原文地址:https://www.cnblogs.com/panpanwelcome/p/10678638.html
Copyright © 2011-2022 走看看