主要 用到layer 自带的取子页面dom的方法 layer.getChildFrame(),在父页面对子页面dom进行操作
js代码:在layer.open 中 btn yes function(index, layero){ }中 获取子页面的dom 进行操作:
$("a[name='editNews']").click(function() { layer.open({ type: 2, title: '编辑', shadeClose: true, shade: 0.8, area: ['99%', '99%'], offset: ['2px'], content: '/gcsoft/news/getNewsDetailById.action"data-value"), btn: ['提交', '取消'], yes: function(index, layero) { //取子页面的form var newsFrom = layer.getChildFrame('#newsFrom', index); //取子页面的layeidt LAY_layedit_1 var layeditCt = layer.getChildFrame('#LAY_layedit_1',index).contents().find('body'); //获取layedit中的html标签 并且赋值给子页面定义的Id为'content' textarea layer.getChildFrame('#content', index).val(layeditCt[0].innerHTML); if(newsFrom.find("#menuId").val() == '' || newsFrom.find("#menuId").val() == -1 || newsFrom.find("#title").val() == '') { layer.msg('标题和栏目不能为空'); return } //ajax提交 $.ajax({ type: "POST", dataType: "json", url: "/gcsoft/news/addOrUpdateNews.action", data: newsFrom.serialize(),//newsForm序列化 success: function(result) { layer.msg('保存成功!'); layer.closeAll(); }, error: function() { alert("异常!"); } }); }, btn2: function() { window.location.reload(); } }); });
HTML 代码: 可以忽略不看
<div class="container-fluid"> <div class="row-fluid"> <div class="box"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="/gcsoft/news/listAllNews.action" rel="external nofollow" >信息列表</a></li> <li class="breadcrumb-item active" aria-current="page">新增/修改信息</li> </ol> </nav> <div> <div class="container"> <form id="newsFrom" class="form-horizontal input-prepend" method="post" > <div class="row"> <div class="col-sm-6"> <div class="input-group mb-4"> <div class="input-group-prepend"> <span class="input-group-text">新闻标题</span> </div> <input type="text" class="form-control" id="title" name="title" value="<#if news "> </div> </div> <div class="col-sm-6"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">作者</span> </div> <input type="text" class="form-control" id="wen" name="wen" value="<#if news "> <span id="wen_span" class="help-inline"> </span> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="input-group mb-3"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect01">一级栏目</label> </div> <select class="custom-select" id="Select1" ><option value="-1">------------------ 空 ------------------ </option></select> </div> </div> <div class="col-sm-4"> <div class="input-group mb-3"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect01">二级栏目</label> </div> <select class="custom-select" id="Select2" ><option value="-1">------------------ 空 ------------------ </option></select> </div> </div> <div class="col-sm-4"> <div class="input-group mb-3"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect01">三级栏目</label> </div> <select class="custom-select" id="Select3"><option value="-1">------------------ 空 ------------------ </option></select> </div> </div> <input type="hidden" check-type="required" id="menuId" name="menuId" value="<#if news "> </div> <div class="row"> <div class="col-sm-6"> <div class="input-group mb-3"> <input type="text" class="form-control" name="imgUrl" id="imgUrl" value="<#if news " > <div class="input-group-append"> <button class="btn btn-outline-secondary" type="button" id="imageUpload">上传图片</button> <button class="btn btn-outline-secondary" type="button" id="imageDele" >删除图片</button> </div> </div> </div> <div class="col-sm-6"> <div class="input-group mb-3"> <input type="text" class="form-control" name="videoUrl" id="videoUrl" value="<#if news " > <div class="input-group-append"> <button class="btn btn-outline-secondary" type="button" id="videoUpload">上传视频</button> <button class="btn btn-outline-secondary" type="button" id="videoDele" >删除视频</button> </div> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="input-group mb-4"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect01">部门</label> </div> <select class="custom-select" data-rel="chosen" id="origin" name="origin" value="<#if news "> <#if dept "${domainInfo.infoCode}" selected="selected"> ${domainInfo.infoName} </option> <#else> <option value="${domainInfo.infoCode}"> ${domainInfo.infoName} </option> </#if> <#else> <option value="${domainInfo.infoCode}"> ${domainInfo.infoName} </option> </#if> </#list> </#if> </select> </div> </div> <div class="col-sm-3"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">发表时间</span> </div> <input type="text" class="form-control datepicker" id="itemTime" name="itemTime" value="<#if news "> <span id="itemTime_span" class="help-inline"> </span> </div> </div> <div class="col-sm-2"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text" >排序</span> </div> <input type="text" class="form-control" id="orderBy" name="orderBy" value="<#if news " οnkeyup="this.value=this.value.replace(/\D/g,'')"/> </div> </div> </div> <div class="row"> <div class="col-sm-12" style="margin-bottom: 20px"> <textarea name="content" id="content" style="display: none;"><#if news "xhePanel" style="top: 50px;left: 50px;"> <div class="xheMenu"> <a href="javascript:void('1')" rel="external nofollow" title="极小" v="1" role="option" aria-setsize="8" aria-posinset="1" tabindex="0"><span style="font-size:10px;">极小(10px)</span></a> <a href="javascript:void('2')" rel="external nofollow" title="特小" v="2" role="option" aria-setsize="8" aria-posinset="2" tabindex="0"><span style="font-size:12px;">特小(12px)</span></a> <a href="javascript:void('3')" rel="external nofollow" title="小" v="3" role="option" aria-setsize="8" aria-posinset="3" tabindex="0"><span style="font-size:14px;">小(14px)</span></a> <a href="javascript:void('4')" rel="external nofollow" title="默认" v="4" role="option" aria-setsize="8" aria-posinset="4" tabindex="0"><span style="font-size:16px;">默认(16px)</span></a> <a href="javascript:void('5')" rel="external nofollow" title="中" v="5" role="option" aria-setsize="8" aria-posinset="5" tabindex="0"><span style="font-size:18px;">中(18px)</span></a> <a href="javascript:void('6')" rel="external nofollow" title="大" v="6" role="option" aria-setsize="8" aria-posinset="6" tabindex="0"><span style="font-size:24px;">大(24px)</span></a> <a href="javascript:void('7')" rel="external nofollow" title="特大" v="7" role="option" aria-setsize="8" aria-posinset="7" tabindex="0"><span style="font-size:32px;">特大(32px)</span></a> <a href="javascript:void('8')" rel="external nofollow" title="极大" v="8" role="option" aria-setsize="8" aria-posinset="8" tabindex="0"><span style="font-size:48px;">极大(48px)</span></a> </div> </div> </div> </div> <input type="hidden" id="itemId" name="itemId" value="<#if news "> </form> </div> </div> </div> </div> </div>
以上这篇layer.open提交子页面的form和layedit文本编辑内容的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年11月26日
2024年11月26日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]