我有一个关于在 mootools 中调用其他函数的问题类(class)。例如:
var f = new Class('foo',
{
test1: function(){
var table = new Element(...);
...
$(table).getElements('input').each(function(input) {
input.addEvent('change', function() {
// how could I call test2 and pass the input element?
})
});
},
test2: function(e){
alert(e);
}
});
谢谢。
最佳答案
var f = new Class('foo',
{
test1: function(){
var table = new Element(........);
var me = this;
$(table).getElements('input').each(function(input) {
input.addEvent('change', function() {
me.test2("foo");
});
});
},
test2: function(e){
alert(e);
}
});
关于javascript - 调用mootools类中的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1580846/