首页 > 解决方案 > 从弹出窗口重定向时恢复窗口大小

问题描述

可能有一个简单的解决方案,但我不知道它是什么。我有一个弹出窗口,我在其中执行标准 Response.Redirect 到新页面,基于单选按钮选择。一切都按预期工作,但新页面与弹出窗口大小相同(因为它出现在同一个弹出窗口中)。我将如何使新页面显示为普通页面而不是在弹出窗口中?


function EditOrder(f) {

var orderid_values = document.getElementsByName('OrderIDValues');
var orderid_value;

    for(var i = 0; i < orderid_values.length; i++){
        if(orderid_values[i].checked){
        orderid_value = orderid_values[i].value;
        }
    }

    window.open("/memberlogin/orders/editorderpopup.asp?cert=<%=sCertificate%>&loginid=<%=iSessID%>&cid=<%=iCustomerID%>&oid=" + orderid_value,"dialogCancelOrder","resizable=0,scrollbars=yes,location=yes,toolbar=no,status=no,top=200,left=500,width=900,height=900")

} 
</script> 

然后,在 EDITORDERPOPUP.ASP 页面中,根据选择的单选按钮发生以下重定向(这只是页面中的一个片段):

' Based upon the radio button value (1,2,3.., etc.), call the EDITORDER.ASP page with the "editmode" = to the same value:

sURL = sRootDomain & "/administration/manualordering/editorder.asp?cert=" & sCertificate & "&loginID=" & iSessID & "&EditMode=" & RadioButtonValue

然后新页面显示在弹出窗口中。我希望新页面是一个全新的窗口,或者是一个完整的窗口。

标签: javascriptredirectasp-classicpopup

解决方案


Response.Redirect将始终出现在同一个窗口/选项卡中,因此要重定向到另一个窗口/选项卡,您应该使用客户端而不是服务器脚本。

例子:

使用客户端打开弹出窗口的母版页<script>

<button onclick="popup()">Open popup</button> 
<script> 
    function popup() {
        window.open('popup.asp', '', 'height=400,width=400');
    }
</script>

popup.asp 除了客户端什么都没有<script>

<input type="radio" id="a" name="r1" onclick="win1()" />
<input type="radio" id="b" name="r1" onclick="win2()" />

<script>
    function win1() {
        window.open('https://stackoverflow.com');
    }
    function win2() {
        window.open('https://microsoft.com');
    }
</script>

推荐阅读