2012-07-17 46 views
0

我使用jQuery插件通知:http://needim.github.com/noty/如何在模態窗口中執行opener窗口中的方法?

這就是我所說所顯示的通知的方法方式:

noty({force: true, timeout: false, text: 'Hello noty', type: 'information'}); 

的代碼工作正常,但現在,在一個模態窗口是,只要關閉模式窗口,我需要在opener窗口中執行那個調用...我想我應該使用window.opener,但不知道如何爲這種情況做。

回答

1

,你可以在你的首戰窗口定義JS功能:

function invokeSuccessNotification(msg){ 
     noty({force: true, timeout: false, text: 'Hello noty', type: 'information'}); 

    } 

然後,在你的模式窗口,調用像這樣的方法:

window.opener.invokeSuccessNotification();