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

首頁 > 編程 > JavaScript > 正文

詳解layui彈窗父子窗口之間傳參數的方法

2019-11-19 14:31:02
字體:
來源:轉載
供稿:網友

本文介紹了layui彈窗父子窗口之間傳參數的方法,分享給大家,具體如下:

1、父頁面打開子頁面并向子頁面傳參數

function setChooseValues(ret){      var oView = document.getElementById("userName");      var oValue = document.getElementById("userIds");      var i = 0;      if( ret != null){        oValue.value="";        oView.value="";        oView.title="";        for( x in ret){          i++;          oView.title=oView.title + ret[x].name+",";          oValue.value=oValue.value+ret[x].id+",";          oView.value = oView.value+ret[x].name+"/n";        }        if(i==0){          oView.value="";        }      }    }    function OpenFrame( oValue, oView) {      var dialogArgumentsA = new Array(oValue.value , spitToString(oView));      var url = "${rootPath}/page/system/roleallot/role_allot.jsp";      layer.open({        type: 2,        skin: 'layui-layer-lan',        title: '選擇人員',        fix: false,        shadeClose: false,        maxmin: true,        id:'selectUser',        move: false,        closeBtn:2,        //以下代碼為打開窗口添加按鈕        /* btn: ['確定', '取消'],       btnAlign: 'c',       yes: function(index, layero){         /* //layer.closeAll();//關閉所有彈出層         //var parentWin = layero.find('iframe')[0];         var parentWin = layer.getChildFrame('body', index);         alert(parentWin);         parentWin.contentWindow.doOk();         //layer.close(index);//這塊是點擊確定關閉這個彈出層       }, */        area: ['750px', '450px'],        content: url,        success: function(layero, index){          var body = layer.getChildFrame('body', index);          var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe頁的窗口對象,執行iframe頁的方法:iframeWin.method();          var ids = dialogArgumentsA[0].split(",");          var names = dialogArgumentsA[1].split(",");          for (var i = 0; i < ids.length; i++ ) {            if ('' != ids[i]) {              var option = $("<option>").val(ids[i]).text(names[i]);              body.find('select').append(option);            }          }        }      });    } 

2、子頁面向父頁面傳參數并關閉彈窗

function newBuildReturnValue(selectName){   var ret = new Array();        $("#"+selectName+" option").each(function(){       //遍歷所有option          var value = $(this).val();  //獲取option值           var text = $(this).text();         if(text!=''){             var o = new Element(value, text, 0);          ret.push(o);         }       });     return ret;    }    //點擊確定向子頁面傳參并關閉窗口    function doOk(){      var ret = newBuildReturnValue("select");      parent.setChooseValues(ret);      var index = parent.layer.getFrameIndex(window.name);      parent.layer.close(index);    }        //點擊取消關閉窗口        function doCancel(){      var index = parent.layer.getFrameIndex(window.name);      parent.layer.close(index);    }  

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 萝北县| 马鞍山市| 锡林郭勒盟| 西平县| 正阳县| 藁城市| 嘉禾县| 安国市| 新竹县| 崇仁县| 沙洋县| 海林市| 白朗县| 庆阳市| 马鞍山市| 霍山县| 耒阳市| 镇江市| 平泉县| 千阳县| 万安县| 永昌县| 门源| 鄱阳县| 武隆县| 赤峰市| 三明市| 丰顺县| 井冈山市| 津市市| 延寿县| 泽普县| 石屏县| 荣昌县| 枝江市| 清水县| 孟津县| 平湖市| 文山县| 公主岭市| 靖宇县|