GoalCompare HTML and JavaScript and decide which pages and apps need content that changes.
New words
Venn diagram · a drawing with overlapping circles that shows what is different and what is the sameuser · the person who uses a page or an appinteraction · what a user does to a page, such as pressing a buttonshopping basket · a list that grows as a shopper adds things
Explanation
Which language should you choose? It depends on the job. HTML is popular for smaller websites and is easier to start with. It builds pages that are set and fixed. A language such as JavaScript is better when the page must change because of the user, and it can make the page feel personal. What do they share? Both are languages for making websites. A Venn diagram shows this well: put what only HTML does in one circle, what only JavaScript does in the other, and what both do in the middle. To decide if a page needs content that changes, ask: does it have to react to something the user does? A chat, a game score and a shopping basket all do. A poster of school rules does not. Many pages mix both: the title is fixed, but the number of items in a basket changes.
Worked examples
Three pages that must change as users act: a chat page, because new messages arrive; a game page, because the score moves; a shopping page, because the basket grows with each item.
add 2 books: Items 2→add a pencil: Items 3
Karim fills a basket. He adds 2 books and the page says ‘Items: 2’. He adds a pencil and it says ‘Items: 3’. The number changes after each action, which is dynamic content.
Part of the page
Static or dynamic?
title: Today’s weather
static
the temperature
dynamic
a note: ‘Take care’
static
A weather page for a pretend town. The words ‘Today’s weather’ are static. The temperature must be updated all day, so it needs a language that can change the page.
Class activity
Venn and choose. Draw a Venn diagram with HTML and JavaScript and put these in the right place: ‘easier to start’, ‘reacts to the user’, ‘used to build websites’, ‘best for a small fixed page’. Then imagine a page that shows boat trips on the Nile: which parts stay fixed and which parts must change when a visitor picks a day? Say which language fits each part.
Practice
1
What do HTML and JavaScript have in common?
Both are languages for making websites.
2
Which one is better for content that changes with the user?
JavaScript.
3
Give three examples of pages or apps that must change as users act.
For example: a chat, a game score, a shopping basket.