JavaScript Events Worksheet
Questions
Question 1
What is an 'event handler'?
Event handler (in reference to javascript) are functions that are used when an event occurs. Events such as mouseover, or on click would count as an event.
Question 2
How are event handlers invoked?
The browser invoke events handlers when the event occurs.
Question 3
What is an 'anonymous' function?
These are event handler functions that don't have names.
Question 4
Explain what the addEventListener() method of a DOM element is, and explain the purpose of each of it's parameters.
The addEventListener allows an event to be hooked on a property. The first parameters is a string, that is used to name the efvent you want to 'listen' for. The second parameter is a function or the event handler that you want to happen after the first parameter happens.
Coding Problems
Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.
Always test your work! Check the console log to make sure there are no errors.
Orange
Green