190R6 Event Driven Programming

Procedural programming are scripts or compiled code that runs through the instruction set as soon as the programme is loaded and run

Event Driven programming is where the user triggers the action, rather than it happening automatically (eg when the programme is loaded)

  • the actual programming for the event is still procedural/ OOP


a JS event

eg Javascript & HTML

An HTML event can be something the browser does, or something a user does.

Here are some examples of HTML events:

  • An HTML web page finished loading
  • An HTML input field was changed
  • An HTML button was clicked

Javascript then carries out the required action

ACTIVITY
  1. Visit the W3Schools page to practice:
    1. what are the common events in HTML?
    2. what are the common event handlers in JS(HTML)?
    3. what do they do?
    4. Write down the answers to create your own notes
  2. Try the TEST (opens in a new tab)(3 questions)
  3. Look at the full range of event handlers
    1. Write down 6 that look fun!
    2. click the event name to see what it does
    3. try the example & make a note