【问题标题】:window.open on load page (ASP.NET) using Method=POST使用 Method=POST 在加载页面 (ASP.NET) 上打开 window.open
【发布时间】:2012-02-06 02:34:48
【问题描述】:

我需要使用 post 方法和 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 因为需要自定义弹出窗口

谢谢

【问题讨论】:

    标签: asp.net javascript post


    【解决方案1】:

    我认为你应该操纵对象:

    parentWindow
    

    document 对象内;在提交表单之前,如下所示:

    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;
    }
    

    【讨论】:

      【解决方案2】:

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

      因此,唯一需要的更改如下:

      <form ... target="passwd">
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多