Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Lesson details

      Learning outcome

      I can use JavaScript to add interactivity to a web page.

      Key learning points

      1. JavaScript can be used to change HTML content and styles dynamically to make web pages interactive.
      2. The Document Object Model (DOM) allows JavaScript to access and modify web page elements.
      3. Event listeners detect user actions (such as clicks and key presses) and trigger JavaScript functions.
      4. Functions in JavaScript allow us to write reusable code that updates and responds to user interactions.

      Keywords

      • JavaScript - a programming language used to add interactivity to web pages

      • DOM (Document Object Model) - a representation of a web page that JavaScript can use to access and change HTML elements

      • Event listener - a function that waits for a user action (such as a click) and then triggers a response

      Common misconception

      JavaScript changes the original HTML file.

      JavaScript only changes what the user sees in the browser. It does not change the actual HTML file saved on your computer or server.

      Teacher tip

      Pupils will have encoutered many uses of HTML in the world around them. Tailor the activities in the slides to best reflect the experiences pupils in your school will have had when using HTML-based technology.

      Equipment

      Pupils will need access to a device with HTML editing software. Examples in this lesson use the RPF Code Editor https://oak.link/html-editor

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      6 Questions

      Q1.
      What is a wireframe?

      a tool for writing HTML code
      Correct answer: a plan that outlines the basic structure and layout of visual content
      a type of CSS property
      a way to test a web page

      Q2.
      What does the CSS box model explain?

      how to write JavaScript code
      how to create a wireframe
      Correct answer: how HTML elements are structured and spaced
      how to design a database

      Q3.
      What is the purpose of a house style?

      Correct answer: to style content in a consistent way
      to create floating elements
      to write code for web pages
      to test web page designs

      Q4.
      What is the purpose of placing divisions inside other divisions?

      to add animations to a web page
      to create a wireframe
      to write CSS code
      Correct answer: to control groups of content

      Q5.
      What is the main advantage of using a house style?

      it makes coding faster
      Correct answer: it ensures everyone creating designs for a product makes it look the same style
      it adds animations to a web page
      it helps create wireframes

      Q6.
      Match the tasks to their purposes:

      Correct Answer:creating a wireframe,to plan the structure and layout of a web page
      Correct Answer:using a house style,to ensure consistent design across a website
      Correct Answer:applying the floating property,to position elements in a layout
      Correct Answer:using the CSS box model,to structure and space HTML elements

      6 Questions

      Q1.
      What is JavaScript used for in web pages?

      storing data
      designing layouts
      creating databases
      Correct answer: adding interactivity

      Q2.
      What does DOM stand for in web development?

      Correct Answer: Document Object Model

      Q3.
      What does the following line of code do?
      1
      <script src="scripts.js"></script>
      Code colour

      creates a new JavaScript file
      Correct answer: links an external JavaScript file to the HTML page
      runs a CSS file on the web page
      adds a new HTML element to the web page

      Q4.
      What does JavaScript change when it modifies a web page?

      Correct answer: the content displayed in the browser
      the original HTML file
      the server settings
      the database structure

      Q5.
      What function in JavaScript waits for a user action, such as a click, and then triggers a response?

      Correct Answer: event listener

      Q6.
      What does the following code do?
      1
      let name = document.getElementById("username").value;
      Code colour

      Correct answer: gets the value of an element with the ID "username"
      changes the value of "username" to name
      deletes the element with the ID "username"
      creates a new element with the ID "username"

      To help you plan your 11 computer science lesson on: JavaScript, download all teaching resources for free and adapt to suit your pupils' needs...