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;width: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>

  

原文地址:https://www.cnblogs.com/panpanwelcome/p/10678638.html

时间: 2024-08-30 16:45:08

bootstrap:modal & iframe的相关文章

bootstrap modal垂直居中

使用过bootstrap modal(模态框)组件的人都有一种困惑, 好好的一个弹出框怎么就无法垂直居中了呢? 当然网上一些前辈也给出了不少答案, 感觉不太全而且针对的都是各自的项目难以给我等小白太直观的理解.因而手痒试试写个稍微完整点的解决方案, 作为总结及日后回顾之用. 项目中的bootstrap版本是3.X , 作为项目后台使用. 在项目进行过程中遇到组件弹出框无法垂直居中,示例demo代码如下: <!DOCTYPE html> <html> <head> <

bootstrap modal 模态框拖拽扩展

主管要求bootstrap modal 带有拖拽移动效果.代码如下: JS 1 // bootstrap 模态框窗口 移动扩展, 在bootstrap 初始化后 调用 2 var btModalMoveEx = function () { 3 function moveEx($this) { 4 var $head = $this.find(".modal-header"), $dialog = $this.find(".modal-dialog"); 5 var

Bootstrap modal常用参数、方法和事件

Bootstrap modal(模态窗)常用参数.方法和事件: 参数: 名称 类型 默认值 描述 Backdrop Boolean或字符串"static" True True:有背景,点击modal外部,modal消失. False:无背景,点击modal外部,modal不消失. Static:有背景,点击modal外部,modal不消失. Keyboard Boolean True True:键盘上的esc按下关闭modal False:键盘上的esc按下不关闭modal Show

bootstrap modal 垂直居中对齐

bootstrap modal 垂直居中对齐 文章参考 http://www.bubuko.com/infodetail-666582.html http://v3.bootcss.com/JavaScript/#modals Html代码   <div class="modal fade" id="sqh_model"> <div class="modal-dialog"> <div class="mod

IE11下,CKEditor在Bootstrap Modal中的下拉问题

原问题解决方案链接:http://ckeditor.com/forums/CKEditor/Editor-Dropdowns-dont-work-in-IE11 最近在项目中需要在Bootstrap Modal弹出框中载入CKEditor. 初始化CKEditor以后,在IE11下,格式/字体/颜色的下拉会闪现一下后就消失,但在chrome和firefox下没问题. Google了以后终于找到解决方法. 以下代码添加了$(e.target.parentNode).hasClass('cke_co

对bootstrap modal的简单扩展封装

对bootstrap modal的简单扩展封装 参考自:http://www.muzilei.com/archives/677   注:原文不支持bootstrap新版本,并且居中等存在问题 此段时间一直在学习bootstrap,主要是用于做后台,一直习惯用easyui,ui,jgrid前端框架,以至于并不习惯bootstrap的风格.近来考虑到easyui性能不太好,就用了bootstrap,先说下我所了解的bootstrap. 1.外国的框架用于显示中文看着总是不妥. 2.默认的样式觉得有些

在bootstrap modal 中加载百度地图的信息窗口失效解决方法

这个问题其实很傻,解决方法没有任何技术含量,只是记录下工作中发生的事. 前阵子给一个汽车集团客户做了一个经销商查询系统,其中一个功能是使用地图标注经销商店面地址,并且实现导航功能. 页面演示地址:http://www.lyytqm.com/Dealerships 点击地址区域在模态窗口中显示百度地图,并在地图中标注点位,显示窗口信息,但信息窗口展示的信息频繁失效,仅显示名称. 更换了各种加载数据方式不能解决,在蹲厕所时想到了原因,即可给出解决方法. 原因是bootstrap modal 以及动画

解决 select2在bootstrap modal中不能正常使用问题

select2在bootstrap modal中不能正常使用问题 设置CSS .select2-drop { z-index: 10050 !important; } .select2-search-choice-close { margin-top: 0 !important; right: 2px !important; min-height: 10px; } .select2-search-choice-close:before { color: black !important; } /

bootstrap modal

在此输入代码 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <!--IE--> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content=&q