[javascript] How to change onClick handler dynamically?