Programming languages and web pages
People speak many languages, and computers have languages too. A programming language is a set of commands written as sentences, so that a computer can follow them and run a program. Think of a recipe: the cook reads the sentences one by one and does what each says. HTML is one of the languages that people often use for web pages. A page made with HTML shows static content: it is set and stays the same for every visitor, like the opening hours of a library. Other pages need to change when a visitor does something, for example a score that goes up in a game. That is dynamic content. A language like JavaScript can create it. Note that JavaScript and Java are two different languages. Remember Week 8: HTML tags wrap each part of a page.
| Static content | Dynamic content |
|---|---|
| same for every visitor | changes with the user |
| built with HTML | built with a language such as JavaScript |
| opening hours | game score |
1<h1>Town museum</h1> 2<p>It opens at 9 in the morning.</p>
Town museum It opens at 9 in the morning.
| Player | Answer | Score |
|---|---|---|
| Habiba | right | 3 → 4 |
| Karim | wrong | 3 → 3 |
Sentence hunt. In pairs, write five commands for a pretend robot that crosses a room, one sentence each, in the right order (for example: ‘Stand up’, ‘Walk three steps’). Swap lists and follow your partner’s commands exactly. What happens when one command is missing? Then write two pages you know that stay the same for everyone.