我有一个弹出登录表单。我希望提交表单,然后关闭该弹出窗口。我怎样才能做到这一点?该窗口当前设置为在函数返回之前关闭。在这种情况下 window.close() 去了哪里?感谢您的帮助。
表格:
<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" />
<a href="/_System/SystemPages/PasswordRetrieveRequest">Lost password?</a></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;
}
theForm.submit();
window.open('http://www.redlakewalleye.com/promotional/activation-form','_blank');
window.close();
return false;
}
//]]>
</script>
</form>
最佳答案
如果可能,window.close() 应包含在服务器对提交事件的响应中。如果您将 window.close() 作为表单提交的一部分包含在内,则会导致您的表单在提交实际发生之前关闭。
关于Javascript,如何提交表单,然后关闭当前窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19915391/