layer彈出層自定義提交取消按鈕的例子
首先從js開始
/** * 檢查是否選中 */ Sendandre.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if (selected.length === 0) { Feng.info("請先選中表格中的某一記錄!"); return false; } else { Sendandre.seItem = selected[0]; console.log(Sendandre.seItem); return true; } }; /** * 點(diǎn)擊修改按鈕時 */ Sendandre.openChangestan = function () { if (this.check()) { this.layerIndex = layer.open({ type: 2, title: '修改收派標(biāo)準(zhǔn)', area: ['800px', '400px'], //寬高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/sendandreceive/stander_edit?sendid=' + this.seItem.sendid, success: function (layero, index) { //成功獲得加載changefile.html時 //// console.log(obj.data.editAble); var body = layer.getChildFrame('body', index); //console.log(rowselect[0].filename); body.find(".sendname").val(Sendandre.seItem.sendname); //通過class名進(jìn)行獲取數(shù)據(jù) body.find(".minwe").val(Sendandre.seItem.minwe); body.find(".maxwe").val(Sendandre.seItem.maxwe); } }); } };
然后是彈出層加載的界面
@layout("/common/_dialog.html",{plugins:["laydate","sweet-alert","layer"],js:["/assets/modular/system/basic/sendandre/send_edit.js"]}){ <div class="container-fluid"> <form id="sendandreForm"> <div class="row"> <div class="col-6"> <div class="form-group"> <h5>標(biāo)準(zhǔn)名稱 <span class="text-danger">*</span></h5> <div class="controls"> <input name="sendname" type="text" class="form-control sendname" id="sendname"> </div> </div> <div class="form-group"> <h5>最小重量 <span class="text-danger">*</span></h5> <div class="controls"> <input name="minwe" type="text" class="form-control minwe" id="minwe"> </div> </div> <div class="form-group"> <h5>最大重量 </h5> <div class="controls"> <input name="maxwe" type="text" class="form-control maxwe" id=""> </div> </div> </div> </div> <div class="row"> <div class="col-6"> <div class="text-xs-right"> <button class="btn btn-info normal-button-width" onclick="ensure()">提交</button> <button class="btn btn-inverse normal-button-width m-l-10" onclick="closehe()">取消</button> </div> </div> </div> </form> </div> @}
然后是js函數(shù)實(shí)現(xiàn)
/** * 關(guān)閉此對話框 */ closehe = function () { console.log("close"); // var inde=parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name); console.log(index); parent.layer.close(index); }; ensure = function () { console.log("daodao"); };
途中有一個錯誤就是把函數(shù)名稱成為close()了,這個和關(guān)鍵字重復(fù)了,導(dǎo)致沒有效果出現(xiàn),關(guān)閉不了。
以上這篇layer彈出層自定義提交取消按鈕的例子就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
javascript垃圾收集機(jī)制與內(nèi)存泄漏詳細(xì)解析
本文是對javascript中的垃圾收集機(jī)制與內(nèi)存泄漏進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-11-11使用JS實(shí)現(xiàn)在空白頁上展示出一個有趣的時鐘
在我們?nèi)粘5木W(wǎng)頁瀏覽中,空白的頁面往往會被視為一種無趣的事物,一片等待填充的空間,今天我們來學(xué)習(xí)一下如何使用JS在空白的網(wǎng)頁上展示出一個有趣的時鐘吧,感興趣的小伙伴跟著小編一起來看看吧2024-04-04node.js 一個簡單的頁面輸出實(shí)現(xiàn)代碼
最近決定重拾node.js,用它來做一個合并JS文件的東西。由于忘得差不多了,先看能不能輸出一個頁面來再說。以下是我的一些筆記,省得以后又忘凈光2012-03-03微信小程序?qū)崿F(xiàn)跳轉(zhuǎn)的幾種方式總結(jié)(推薦)
這篇文章主要介紹了微信小程序跳轉(zhuǎn)方式,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04代碼短小的js div層拖動實(shí)現(xiàn)代碼[兼容IE與Firefox]
代碼短小的js div層拖動實(shí)現(xiàn)代碼[兼容IE與Firefox],需要的朋友可以參考下.2010-05-05JavaScript如何將時間戳轉(zhuǎn)化為年月日時分秒格式
這篇文章主要給大家介紹了關(guān)于JavaScript如何將時間戳轉(zhuǎn)化為年月日時分秒格式的相關(guān)資料,在前端的日常工作當(dāng)中,時間戳的使用也是不少的,有時后端返回給我們的數(shù)據(jù)是一個時間戳,我們需要轉(zhuǎn)換成年月日,時分秒的形式展示在頁面當(dāng)中,需要的朋友可以參考下2023-11-11js超時調(diào)用setTimeout和間歇調(diào)用setInterval實(shí)例分析
這篇文章主要介紹了js超時調(diào)用setTimeout和間歇調(diào)用setInterval,以實(shí)例形式對比分析了setTimeout與setInterval的具體使用技巧,非常具有實(shí)用價值,需要的朋友可以參考下2015-01-01當(dāng)鼠標(biāo)滑過超鏈接出現(xiàn)提示框效果實(shí)例
當(dāng)鼠標(biāo)滑過超鏈接出現(xiàn)提示框效果實(shí)例,需要的朋友可以參考一下2013-04-04