window.showModalDialog

今天接手一个项目用到window.showModalDialog以前完全没有过,既然碰到了就记下来。

function showModalWindow(){
          //var answer = window.showModalDialog(url,window,'dialogWidth:1200px;dialogHeight:700px');
            var orgId = $("#orgId").text();
            var projectList = window.showModalDialog("doctor/inputTestProject?orgId="+orgId,null,
                "dialogWidth=1100px;dialogHeight=590px;center:yes;resizable:no;status:no;scroll:no;");
            
            console.info(projectList);
            if(typeof(projectList)=="undefined")return false;
            $("#packageId").val(projectList[0].packageId);
            $("#packageMoney").val(projectList[0].packageMoney);
            if (projectList != null && typeof(projectList) != "undefined" && projectList.length > 0){
                $("tr[name='mo']").each(function(){
                         $(this).remove();
                    });
                var ids = [];
                var str = "";
                $("#ProjTab tr").each(function(index, item){
                       ids.push(item.id);
                });
                
                for(var i = 0; i<projectList.length; i++){
                        str += "<tr name='mo' id='"+projectList[i].projectId+"' rowType='add'>"
                        +"<td class='biaotd'>"+Number(i+1)+"</td>"
                        +"<td class='biaotd'>"+projectList[i].projectName+"</td>"
                        +"<td class='biaotd'>"+projectList[i].projectType2Name+" &nbsp;</td></tr>"
                    }
                $("#ProjTab tr:last-child").before(str);
                changeFrame();
            }
        //window.location.reload(); //刷新父窗口 
    }
window.showModalDialog弹出一个模态窗口,窗口关闭之前该方法会一直阻塞在哪里,窗口关闭之后才会继续往下执行(即窗口关闭之后才会执行包含console.info(projectList);之后的语句);
欢迎大家前来指正
原文地址:https://www.cnblogs.com/ph123/p/4410237.html