Art 114: Interactive Media and Design

Spring 2025 | Harrisburg Area Community College

Instructor: Rich Hauck, MPS

Exercise 5

Functions and Event Handling

  • Write a function that takes two numbers as parameters, performs a mathematical equation, and outputs them on the page.
  • Create an event listener that changes something on the page when an event has occurred. The event you listen for is up to you. It could be user input (keystroke, mouse click, scrolling/window resizing) or the passage of time.
Have a look at MDN Introduction to Events for a primer (though your exercises should be original and not be copies of the examples).