zoukankan      html  css  js  c++  java
  • layer iframe大致使用

    function addOrUpdate(id,type) {
    if(type == 'update'){
    var title = "修改";
    }
    if(type == 'add'){
    var title = "新增";
    }

    var typeid = "${typeid}"
    var url = "<s:url value='/aaaa.shtml'></s:url>" + "?id=" + id + "&typeid=" + typeid;
    layer.open({
    type: 2,
    title: title,
    //shadeClose: true,
    skin: 'layui-layer-lan',
    shade: [0.5, '#393D49'],
    maxmin: true, //开启最大化最小化按钮
    area: ['1000px', '600px'],
    content: url,
    btn: ['保存', '取消'],
    yes: function (index, layero) { //或者使用btn1
    var body = layer.getChildFrame('body', index);
    var commitForm = body.find('#myform');
    var iframeWin = window[layero.find('iframe')[0]['name']];
    var flag = iframeWin.checkInfo();
    if (flag) {
    var formData = commitForm.serialize();
    saveNews(formData);
    }
    }, btn1: function (index) {
    layer.close(index);
    }
    });
    }
    function saveNews(formData) {
    var url="<s:url value="/bbbbbb.shtml"/>";
    $.ajax({
    cache: true,
    type: "POST",
    url:url,
    data:formData,
    async: false,
    success: function(data) {
    if(data){

    }else {
    layer.alert("保存失败!", {
    icon: 5,
    skin: 'layer-ext-moon',
    anim: 6
    });
    return false;
    }
    }

    });
    }



    iframe层为form表单

     <form action="" method="post" id="myform" enctype="multipart/form-data">
            <div class="form-group row">
                <div class="left col-xs-3 text-right">
                <label for="">名称:</label>
                </div>
                <div class="right col-xs-8 text-left">
                <input type="text" class="form-control" id="name" name="name" placeholder="">
                </div>
            </div>
        </form>


    function checkInfo(){
    //检测参数,返回flag
    }
  • 相关阅读:
    Bitnami WordPress如何让默认URL指向WordPress目录?
    单片机调试
    FreeRTOS
    FreeRTOS
    FreeRTOS
    FreeRTOS
    FreeRTOS
    FreeRTOS 问题归纳
    单片机通信的加密和解密
    IAR ------ 扩展关键字__weak
  • 原文地址:https://www.cnblogs.com/libo199374/p/7942727.html
Copyright © 2011-2022 走看看