我正在从模式窗口向新选项卡提交表单。我希望表单提交,模态关闭,模态的父级刷新。新选项卡打开良好,模态不会关闭。我在模态php脚本中使用了同样的js,最后一行是RefWin(),当脚本结束时,模态关闭,父级刷新。模态窗口是一个jquery插件,我确实想使用javascript来关闭模态。我尝试过使用onsubmit和onclick,但都不起作用。我知道有一个简单的答案,我被难住了。。。感谢您的帮助。
<script>
function reloadSource() {
var p_ref=parent.location.href;
parent.location.href=(p_ref);
}
function RefWin() {
window.open('', '_self', '');
window.close();
reloadSource();
}
</script>
<form action="https://www.paygate.com/p/" method="POST" target="_new" onsubmit="RefWin();">
<input type="text" name="v1" maxlength="200" value="100.00" />
<input type="text" name="v2" maxlength="200" value="Software" />
<input type="image" name="submit" src="http://www.myurl.com/img/paybutton.gif" border="0" />
</form>
也许可以尝试使用$('.modal').remove();
其中".modal"是模态的类