当前位置:编程学习 > 网站相关 >>

chrome浏览器无法得到window.showModalDialog返回值解决方法

chrome浏览器functionobject
父页面:

function openwindows(){ 
        var obj = new Object(); 
        //obj.ordernumlst=new Array("001","002","003"); 
        var retval = window.showModalDialog("ordervideo.jsp?orderIds="+"0010,0020,0030",obj,"dialogWidth=500px;dialogHeight=500px"); 
         
        //for chrome 
        if(retval == undefined) { 
            retval = window.returnValue; 
        } 
        alert(retval); 
     } 

子页面:

function onload(){ 
    var flag = '<%=request.getAttribute("resultflag")%>'; 
    if(flag == 'error') { 
        //for chrome 
        if(window.opener != undefined) { 
            window.opener.returnValue = flag; 
        } else { 
            window.returnValue=flag; 
        } 
        window.close(); 
    } 
    else if (flag == 'save') { 
        //for chrome 
        if(window.opener != undefined) { 
            window.opener.returnValue = flag; 
        } else { 
            window.returnValue=flag; 
        } 
        window.close(); 
    } 

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,