2014-06-10 227 views
0

我沒有打開子窗口的功能。但是我返回false,父窗口正在刷新。我已經返回false語句,但它永遠不會被執行,因爲控制權將轉到子窗口。防止父窗口刷新打開子窗口

function openChild() 
{ 
    childWindow = window.open('' + child_url + '', 'XREF_topic_product_ADD', 'scrollbars=1, statusbar=1, resizable=1, toolbar=0, location=0, menubar=0, height=250, width=800'); 
    childWindow.focus(); 
    return false; 
} 

<a id="addTopicProduct" href="#" onclick="openChild();return false;" >Add Topic Product</a> 
+0

你看到'中的地址欄#'追加到URL父窗口?你點擊的鏈接在頁面的下方多少?當你說窗口「刷新」時,你是什麼意思:是通過觸發一個新的請求重新加載頁面還是將它重新設置迴文檔的頂部?後者暗示我關於URL的第一個問題。 –

+0

頁面刷新=重新加載父元素的所有元素,以及使ajax調用我在父類中定義的任何內容。 – kayra

+0

我的猜測是頁面上有另一個javascript錯誤。你在這裏工作得很好(顯然替換child_url):http://jsfiddle.net/A6Ves/1/ –

回答

0

也許問題是「#」嘗試一些簡單的像,改變你的(錨)至:

<a id="addTopicProduct" href="#openwindow" title="open window" onclick="openChild();return false;" >Add Topic Product</a> 
+0

不工作我也試過這個。 – kayra

+0

對不起 編輯: Add Topic Product Asccort