2013-08-28 34 views
0

我正在從模態窗口向新選項卡提交表單。我想要表單提交,關閉模式,以及模式的父級刷新。新標籤打開並且模式不會關閉。我在使用RefWin()作爲最後一行的模態php腳本中使用了相同的js,當腳本結束時,模式關閉,父級刷新。模式窗口是一個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> 

回答

1

也許嘗試使用 $('.modal').remove(); 其中「.modal」是班級的模式

+0

沒有的,沒有工作,也嘗試過的,而不是刪除window.close。正如我上面提到的,我已經關閉了模式,並在用作php文件中的最後一個腳本時刷新父級。只是一直未能弄清楚如何使它與表單提交工作。 – Jim

相關問題