如何将参数传递给Event.observe的处理程序?

时间:2012-01-12 05:02:20

标签: javascript-events event-handling prototypejs arguments

prototype.js具有以下功能

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})

1 个答案:

答案 0 :(得分:3)

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