繁体   English   中英

使用Method = POST在加载页面(ASP.NET)上打开window.open

[英]window.open on load page (ASP.NET) using Method=POST

我需要使用post Method和window.open在asp.net中打开弹出窗口来重新调整新窗口。

我的代码:

打开弹出窗口:

function mdpbch(URL) {
    child = window.open(URL, "passwd","dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=475");
    child.location.href = URL;
    if (child.opener == null) {
      child.opener = window;
    }
    child.opener.name = "opener";
  }

网址:

function PagoEnLinea(Banco)
{
    switch(x){
        case "BCH":
            document.frmEnvia.action = SERV + "/llamacom.asp";
             url = SERV + "lamacom.asp
             alert(url);
             mdpbch(url);
             document.frmEnvia.submit();
            break;
    }    
}

ASPX:

<body>
    <form id="frmEnvia" runat="server" name="formulario" method="post" target="_blank">

    <div style="visibility:hidden;">
        <asp:TextBox ID="txtXml" runat="server" Visible="true" />
    </div>
    .....    
</body>

在页面加载时(后面的代码),我创建一个xml字符串并将其放在文本框txtXml中。

我需要使用post方法,因为服务器验证te方法,而window.open因为需要自定义弹出窗口

谢谢

我认为您应该操纵该对象:

parentWindow

文档对象内部; 在提交表单之前,应执行以下操作:

switch(x){
    case "BCH":
        document.frmEnvia.action = SERV + "/llamacom.asp";
         url = SERV + "lamacom.asp
         alert(url);
         mdpbch(url);
         //here you manipulate the parentWindow element
         document.parentWindow.scrollbars... (add the attributes you need)
         //--
         document.frmEnvia.submit();
        break;
}

由于将弹出窗口的名称设置为passwd ,因此应该可以将表单的target属性设置为passwd

因此,唯一需要的更改是:

<form ... target="passwd">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM