1

ポップアップ ウィンドウに表示されるログイン フォームがあります。フォームが送信された後に新しいフル サイズのウィンドウを開き、現在のログイン フォーム ポップアップ ウィンドウを閉じる JavaScript (通常の js または Ajax を使用する必要があるかどうかはわかりません) を書きたいと思います。どうすればこれを達成できますか? 私の問題は、通常の状況では、ページが更新/リダイレクトされるため、フォーム送信後に他に何もできないことです。私の問題に対する助けや解決策をありがとう.

私はこの質問を見てきました:ポップアップでフォームを送信してから、ポップアップを閉じますが、それを理解できない、またはそれが私の問題に当てはまるかどうか。

形:

<form name="catseczoneform30738" onSubmit="return checkWholeForm30738(this)" method="post" action="https://redlakewalleye.worldsecuresystems.com/ZoneProcess.aspx?ZoneID=12695&Referrer={module_siteUrl,true,true}&OID={module_oid}&OTYPE={module_otype}">
            <div class="form">
              <div class="item">
                <label for="SZUsername">Username</label>
                <br />
                <input class="cat_textbox_small" type="text" name="Username" id="SZUsername" maxlength="255" />
              </div>
              <div class="item">
                <label for="SZPassword">Password</label>
                <br />
                <input class="cat_textbox_small" type="password" name="Password" id="SZPassword" maxlength="255" autocomplete="off" />
              </div>
              <div class="item">
                <input type="checkbox" name="RememberMe" id="RememberMe" />
                <label for="RememberMe">Remember Me</label>
              </div>
              <div class="item">
                <input class="cat_button" type="submit" value="Log in" name="submitButton" />
              </div>
            </div>
            <script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>
            <script type="text/javascript">
//<![CDATA[
    function checkWholeForm30738(theForm){
    var why = "";
    if (theForm.Username) why += isEmpty(theForm.Username.value, "Username");
    if (theForm.Password) why += isEmpty(theForm.Password.value, "Password");
    if (why != ""){
        alert(why);
        return false;
    }
    window.open('http://www.redlakewalleye.com/promotional/activation-form','_blank');
    theForm.submit();
    // window.close(); here?
    return false;
    }
//]]>
            </script>

        </form>
4

2 に答える 2

0

ログインフォームによって開かれた新しいウィンドウに、次のように記述します。

<script type="text/javascript">
if(window.opener != null) {
  window.opener.close(); // close login form
}
</script>
于 2013-11-12T15:42:36.817 に答える