New
New
Year 11
OCR

JavaScript

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

New
New
Year 11
OCR

JavaScript

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

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

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.


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

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.
Teacher tip

Equipment

Access to the Raspberry Pi Foundation's Code Editor or some other means of creating HTML files.

Licence

This content is © Oak National Academy Limited (2025), 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

Download quiz pdf

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

to plan the structure and layout of a web page

Correct Answer:using a house style,to ensure consistent design across a website

to ensure consistent design across a website

Correct Answer:applying the floating property,to position elements in a layout

to position elements in a layout

Correct Answer:using the CSS box model,to structure and space HTML elements

to structure and space HTML elements

Assessment exit quiz

Download quiz pdf

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

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords
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

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords
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"