2013-02-13 68 views
0
<button class="Button" onclick="NewTicket()">New Ticket</button> 

<script language=javascript> 
    function OpenPopup(url, winname, features) 
    { 
    if(winname==''){ 
    window.open(url, winname, features, false); 
    return; 
    } 
    if (!findWindow(url, winname, features)) 
    { 
    var handle = window.open(url, winname, features, false); 
    if (handle != null) handle.focus(); 
    } 
    } 

    function findWindow(url, winname, features) 
    { 
    var handle = window.open('', winname, features, false); 
    if (handle != null) 
    { 
    if ((handle.location != 'about:blank') && (handle.location != '')) 
    { 
     handle.focus(); 
     return true; 
    } 
    } 
    return false; 
    } 
function NewTicket(){ 
    OpenPopup('../Ticket/New.php', 'NewTicket', 'channelmode=0, directories=0, fullscreen=0, width=430, height=360, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0', false); 
} 
</script> 

用此代碼打開彈出窗體。這個沒問題。我想再次發佈表單(../Ticket/New.php)回到這個頁面。我怎樣才能做到這一點?javascript窗體發佈到主窗口

回答

0

您需要爲當前窗口設置一個名稱。在窗口打開功能之前,在打開按鈕的頁面上添加以下代碼片段。

<script>window.name = 'mainwindow';</script> 

在你New.php目標屬性添加到您的形式設置爲「主窗口」

<form target="mainwindow"> 
+0

而如何關閉彈出價值? – milesh 2013-02-13 19:20:35

+0

我假設你想在提交表單後關閉它,所以它將是在彈出代碼中添加。 – 2013-02-13 19:56:58

+0

我在彈出的提交按鈕上使用了onclick =「self.close()」。謝謝。 – milesh 2013-02-14 08:58:30