內訪問JavaScript類變量我有這樣的:一類功能
function FilterSelect(select, search) {
this.select = select;
this.search = search;
// Get the current list options
this.options = this.select.options;
// Whenever the text of the search box changes, do this
this.search.onkeyup = function() {
// Clear the list
while(this.select.options.length > 0) {
this.select.remove(0);
}
}
}
裏面的onkeyup
功能,我想訪問select
的,但我知道的是這是不可能的。什麼是正確的方法來做到這一點?
嘗試增加'this.search.select = this.select'作爲第三你的功能線。 – Blazemonger