国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

layer父頁獲取彈出層輸入框里面的值方法

2019-11-19 10:55:37
字體:
供稿:網(wǎng)友

主要是因為修改功能,原來頁面填寫數(shù)據(jù)如圖

改為

其中點擊填寫明細彈出框

填寫完畢后點擊確認返回,同事這里因為她是存的多表,所以點擊確認就直接保存數(shù)據(jù)了,改的這個功能原本保存是整體保存,我就不想改原來的邏輯,只想把填寫的值帶回去用隱藏控件存一下,到時候按照原來的邏輯整體存,所以沒辦法參考她的,最后搜索很多,解決了問題,具體代碼如下:

父頁面:

<div class="row"><div class="col-md-6"><div class="form-group PadTB10"><label class="LabelW150">經(jīng)費來源總計(元)</label><input type="text" readonly="readonly" class="form-control" id="AmountSum" name="AmountSum" onkeyup="value=value.replace(/[^/d.]/g,'')" placeholder="填寫來源明細" value="@pro.AmountSum"/><input type="button" value="填寫來源明細" onclick="ShowAmountDetail()" /><input type="hidden" name="CenterAmount" id="CenterAmount" value="@pro.CenterAmount" /><input type="hidden" name="CityAmount" id="CityAmount" value="@pro.CityAmount" /><input type="hidden" name="DisAmount" id="DisAmount" value="@pro.DisAmount" /><input type="hidden" name="StreetAmount" id="StreetAmount" value="@pro.StreetAmount" /><input type="hidden" name="OtherAmount" id="OtherAmount" value="@pro.OtherAmount" /></div></div></div>

js:

//彈出經(jīng)費來源明細function ShowAmountDetail() {var index = layer.open({type: 2,title: '填寫經(jīng)費明細',shadeClose: false,skin: 'layui-layer-rim',area: ['50%', '50%'],maxmin: true,content: '/Project/AmountDetail?ProjectCode=' + "@ProjectCode",btn: ['確定', '關閉'],yes: function (index, layero) {debugger;var body = layer.getChildFrame('body', index); //得到iframe頁的body內(nèi)容var CenterAmount = body.find("#CenterAmount").val();var CityAmount = body.find("#CityAmount").val();var DisAmount = body.find("#DisAmount").val();var StreetAmount = body.find("#StreetAmount").val();var OtherAmount = body.find("#OtherAmount").val();if (CenterAmount == null || CenterAmount == "") CenterAmount = 0;if (CityAmount == null || CityAmount == "") CityAmount = 0;if (DisAmount == null || DisAmount == "") DisAmount = 0;if (StreetAmount == null || StreetAmount == "") StreetAmount = 0;if (OtherAmount == null || OtherAmount == "") OtherAmount = 0;sum = Number(CenterAmount) + Number(CityAmount) + Number(DisAmount)+ Number(StreetAmount) + Number(OtherAmount);document.getElementById("CenterAmount").value = CenterAmount;document.getElementById("CityAmount").value = CityAmount;document.getElementById("DisAmount").value = DisAmount;document.getElementById("StreetAmount").value = StreetAmount;document.getElementById("OtherAmount").value = OtherAmount;document.getElementById("AmountSum").value = sum;//最后關閉彈出層layer.close(index);},cancel: function () {//右上角關閉回調(diào)}});// layer.full(index);}

子頁面:

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width" /><title>AmountDetail</title></head><body><div><table class="table table-bordered "><tr><td rowspan="5" style="text-align: center; vertical-align: middle;">經(jīng)濟來源明細</td><td>中央撥款(元)</td><td><input id="CenterAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="CenterAmount" type="text" /></td></tr><tr><td>市級專款(元)</td><td><input id="CityAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="CityAmount" type="text" /></td></tr><tr><td>區(qū)級資金(元)</td><td><input id="DisAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="DisAmount" type="text" /></td></tr><tr><td>街鎮(zhèn)配套(元)</td><td><input id="StreetAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="StreetAmount" type="text" "/></td></tr><tr><td>其他(元)</td><td><input id="OtherAmount" class="form-control" onkeyup="value=value.replace(/[^/d.]/g,'')" name="OtherAmount" type="text" /></td></tr></table> </div></body></html>

以上這篇layer父頁獲取彈出層輸入框里面的值方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 苏尼特右旗| 昌平区| 临沭县| 遂川县| 修水县| 叶城县| 延安市| 南雄市| 台南市| 铜梁县| 涟水县| 江北区| 台中县| 阿尔山市| 兴海县| 云和县| 大城县| 芷江| 荆州市| 邳州市| 日喀则市| 宁化县| 江口县| 吉林省| 巫溪县| 新源县| 新和县| 喀喇沁旗| 万源市| 普陀区| 武平县| 汶上县| 彭山县| 安徽省| 邵东县| 崇仁县| 阳城县| 西华县| 宣武区| 西贡区| 西丰县|