var SortingTable = new Class({
initialize: function(table, options) {
this.table=$(table);
this.tbody = this.table.getElement('tbody');
//...do alot of things here...
},
addTextInput : function(index,headid,options){
var trs = this.tbody.getChildren();
var trslen = trs.length;
var i=0;
var cell = null;
for(i=0;i<trslen;i++){
cell = trs[i].getChildren()[index];
cell.addEvent('dblclick', function (event){
alert(this.innerHTML); // i can see this is the cell here.
this.makeCellEditor(this); // how to access the parent object?
});
}
},
makeCellEditor : function(cell){
//make form and stuff here.
}
//...alot of more functions...
});
在我的dblclick(event)函數中,我想訪問我在「父對象」中聲明的函數makeCellEditor。訪問父javascript對象的變量和方法?
感謝它的工作就像一個魅力! – jonaz 2009-09-24 13:11:22