javascript - 从弹出窗口重定向时恢复窗口大小
问题描述
可能有一个简单的解决方案,但我不知道它是什么。我有一个弹出窗口,我在其中执行标准 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
然后新页面显示在弹出窗口中。我希望新页面是一个全新的窗口,或者是一个完整的窗口。
解决方案
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>
推荐阅读
- java - 将 Java 与模块一起使用
- html - 如何在 HTML5 的不同纵横比下获得相似的结果?
- javascript - 在Javascript中获取未展平的过滤多维数组
- python - 我在 django 中的评论表格不起作用?它既不向数据库发送数据也不显示那些数据?
- networking - 关于 ipv4 和 ipv6
- reporting-services - 在新页面上显示列值,无论它是否已更改
- xml - 额外的价值“无”被打印出来,我不知道为什么
- zabbix - 为什么zabbix在我的Item中看不到Update Interval?
- hyperledger-fabric - 检查期间不可见交易的手动签名(结构 1.4)
- java-8 - Java8获取数据并保存在hashmap中,性能问题