2016-06-23 124 views
0

我已經創建了一個自定義模塊,其中我使用了magento彈出窗口。 我想覆蓋彈出關閉事件。覆蓋Magento彈出關閉onclick事件

<div onclick="Windows.close(&quot;browser_window_updatecc&quot;, event)" id="browser_window_updatecc_close" class="magento_close"> </div> 

這是密切的div id我想替換onclick並在onclick事件上實現我的自定義代碼。

請幫

回答

0

你可以簡單地寫這個執行時,頁面加載:

document.getElementById("browser_window_updatecc_close") 
     .attribute("onclick","newFunctionName()"); 
+0

這是當我使用的getElementById動態添加ID,以便它顯示我的document.getElementById(...)是空的 –

+0

有沒有什麼辦法可以訪問動態ID –

+0

你是在文件加載後做的嗎? –