好吧,假設我有一個按鈕,並且想要啓用/禁用其點擊處理程序。在Javascript中啓用/禁用按鈕單擊處理程序
我想這樣的創建函數:
var bar = [];
function storeHandlers(buttonID) {
//I would like to store the click handlers in bar[buttonID]
}
function preventHandlers(buttonID) {
storeHandlers(buttonID);
//I would like to disable all the click handlers for button
}
function loadHandlers(buttonID) {
//I would like to enable all the handlers loaded from bar[buttonID]
}
這可能嗎?我怎樣才能做到這一點?
預先感謝您
您可以命名空間的事件處理程序,並啓用/處理程序的方式禁用組。 –