js模态对话框返回值接收简单实现

当前页面:

    function popupWind(){
          var userInfo = new Array();
          userInfo = window.showModalDialog   ("xxxxx.do",null,"dialogWidth=1200px;dialogHeight=480px;satus=no;help=no;scrollbars=no");
          if (userInfo != null && userInfo.length != 0) {
              document.getElementById("name").value = userInfo[0];
              document.getElementById("age").value = userInfo[1];
              document.getElementById("address").value = userInfo[2];
              document.getElementById("tel").value = userInfo[3];
           }
   }

popupUp画面:

 

function sed() {
      var radio = document.getElementsByName("radioIndexId");
      var array = new Array();
      for ( var i = 0; i < radio.length; i++) {
           if (radio[i].checked == true) {

                array[0] = document.getElementsByName("name")[i].value;
                array[1] = document.getElementsByName("age")[i].value;
                array[2] = document.getElementsByName("address")[i].value;
                array[3] = document.getElementsByName("tel")[i].value;
                parent.window.returnValue = array;
           }
      }
  window.close();
 }

你可能感兴趣的:(js模态对话框返回值接收简单实现)