Please help: 1) Explain the difference between an event and an event handler. Pr
ID: 3838441 • Letter: P
Question
Please help:
1) Explain the difference between an event and an event handler. Provide at least two examples of an event.
2) Explain how an animation uses still images and loops to create the illusion of motion.
3) Write a function to calculate your wages for a part-time job. (Don’t worry about calculating overtime.)
4) Write a function that simulates rolling a six side dice and keeps a total of the number of rolls and the total sum rolled.
5) Considering the topic for your paper, what programming is involved? What is it used for, and what are some potential uses that are currently overlooked or underutilized?
Explanation / Answer
1)difference between an event and an event handle:
Events are a generalization of all the things the computer can react to. They keyword here is reaction, as in, do something AFTER the event happened. For example, when you press a key, a "keypress" event is fired. You can react to this event somehow. A click, a window resize, a touch gesture are all actions that the computer can react to.
->A handler is an object that handles certain things that the client class don't want to deal with. I.e. it "handles" events. A typical scenario is that I provide a handler for a specific event/task as an argument to a constructor.
Event- something which happened. E.g. Mouse clicks, key down,etc
Event Handler- A callback which is usually called when there is an event
->Events, however, need not be used only for graphical interfaces. Events provide a generally useful way for objects to signal state changes that may be useful to clients of that object.
->
Input Events
onblur - When a user leaves an input field
onchange - When a user changes the content of an input field
onchange - When a user selects a dropdown value
onfocus - When an input field gets focus
onselect - When input text is selected
onsubmit - When a user clicks the submit button
onreset - When a user clicks the reset button
onkeydown - When a user is pressing/holding down a key
onkeypress - When a user is pressing/holding down a key
onkeyup - When the user releases a key
onkeyup - When the user releases a key
onkeydown vs onkeyup - Both