2012-01-12 203 views
0

prototype.js具有以下功能如何將參數傳遞給Event.observe的處理程序?

Event.observe(document, "dom:loaded", foo_function); 

它等待document在執行foo_function之前完成加載。我如何將參數傳遞給foo_function?在東西喜歡的

Event.observe(document, "dom:loaded", foo_function, {arg1: bar_argument, arg2: baz_argument}) 

回答

3
Event.observe(document, "dom:loaded", (function(e, bar_argument, baz_argument) { 
    //now bar_argument = bar,and baz_argument = baz 
}).bindAsEventListener(this, bar, baz)); 
相關問題