2013-02-13 64 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