Writing an event handling script So how do you write an event handling script? On this page I give a quick overview for those who need fast answers and want to study the theory later. Registering an event handler The first step is registering your event handler. You have to make sure that the browser executes your script whenever the event you’ve chosen takes place.