Replaced other events in HTML with event handlers in JS