All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
Page components: slideshows, modal boxes, filters, sorting, pop-ups and tabs
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
JavaScript, HTML and CSS work together to build interactive components. The specification names seven (spec 9.3.4), and the 20-mark JavaScript question asks you to complete components like these.
The pattern behind every component
1. HTML holds the content (all slides, the hidden modal, every tab panel).
2. CSS controls what is visible: a class such as .hidden { display: none; } or .active.
3. JavaScript responds to events by changing classes, styles, src or text.
So most components come down to: find the elements, attach event handlers, and show one thing while hiding the others.
Slideshow
<img id="slide" src="images/a.png" alt="Pool photos">
<p id="caption"></p>
<button id="prev">Previous</button>
<button id="next">Next</button>const slides = ["images/a.png", "images/b.png", "images/c.png"];
let current = 0;
function showSlide(n) {
current = (n + slides.length) % slides.length; // wrap round at both ends
document.getElementById("slide").src = slides[current];
document.getElementById("caption").textContent = "Slide " + (current + 1) + " of " + slides.length;
}
document.getElementById("next").addEventListener("click", function () { showSlide(current + 1); });
document.getElementById("prev").addEventListener("click", function () { showSlide(current - 1); });
window.addEventListener("load", function () { showSlide(0); });Caption after loading, then after three clicks on Next, then after one more click on Previous:
Slide 1 of 3
Slide 1 of 3
Slide 3 of 3The remainder (%) wraps the index round, so Next on the last slide returns to the first. The load handler shows the first slide when the page opens; forgetting to do that cost marks in 2025.
Modal boxes, modal images and pop-ups
A modal box is a dialog shown on top of the page, with the page dimmed behind it, until the user closes it. A modal image opens a large version of a clicked thumbnail in the same way. A pop-up is a small message or box that appears on an event (a tooltip, a confirmation or a 'subscribe' box).
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 100;
}
.modal.show { display: block; }const modal = document.getElementById("modal");
document.getElementById("thumb").addEventListener("click", function () {
document.getElementById("bigImg").src = this.src; // modal image: copy the clicked picture
modal.classList.add("show");
});
document.getElementById("close").addEventListener("click", function () {
modal.classList.remove("show");
});Filter lists, sort lists and tabbed content
// filter: hide list items that do not contain the search text
document.getElementById("search").addEventListener("keyup", function () {
const term = this.value.toLowerCase();
document.querySelectorAll("#classes li").forEach(function (li) {
li.style.display = li.textContent.toLowerCase().includes(term) ? "" : "none";
});
});
// sort: read the items into an array, sort it, write them back
function sortList() {
const list = document.getElementById("classes");
const items = Array.from(list.children).map(li => li.textContent);
items.sort();
list.innerHTML = "";
items.forEach(function (t) {
const li = document.createElement("li");
li.textContent = t;
list.appendChild(li);
});
}
// tabs: show the chosen panel, hide the rest
function openTab(id) {
document.querySelectorAll(".panel").forEach(p => p.classList.add("hidden"));
document.getElementById(id).classList.remove("hidden");
}The filter uses keyup so the list updates as the user types. Tabs hide every panel and then show one, which guarantees only one is visible; Pearson's 2025 report noted few candidates made sure only one button showed at a time.
Worked example
A page has three tab buttons and three panels with class panel and ids info, prices and times. Explain how openTab("prices") makes only the prices panel visible.
- querySelectorAll(".panel") finds all three panels; the loop adds the class hidden to each, so all are hidden.
- getElementById("prices") finds one panel and removes its hidden class.
- The CSS rule .hidden { display: none; } does the hiding, so only prices is shown.
Answer: Hide every panel first, then show the chosen one.
Check yourself
- The slideshow code runs and the page loads, then the user clicks Previous once. What does the caption show?
```js
const slides = ["images/a.png", "images/b.png", "images/c.png"];
let current = 0;
function showSlide(n) {
current = (n + slides.length) % slides.length; // wrap round at both ends
document.getElementById("slide").src = slides[current];
document.getElementById("caption").textContent = "Slide " + (current + 1) + " of " + slides.length;
}
document.getElementById("next").addEventListener("click", function () { showSlide(current + 1); });
document.getElementById("prev").addEventListener("click", function () { showSlide(current - 1); });
window.addEventListener("load", function () { showSlide(0); });
```
Show answer
Slide 3 of 3. Starting at slide 1, Previous wraps round to the last slide, so the caption is Slide 3 of 3.
- What is displayed when this code runs?
```js
const n = 4;
let i = 3;
i = (i + 1) % n;
console.log(i);
```
Show answer
0. (3 + 1) % 4 = 0, so the index wraps back to the first item: 0.
- Which CSS makes a modal box cover the whole window and stay in place when the page scrolls?
- position: static; width: 100%;
- float: left; width: 100%;
- position: fixed; top: 0; left: 0; width: 100%; height: 100%;
- position: relative; top: 100%;
Show answer
position: fixed; top: 0; left: 0; width: 100%; height: 100%;. A fixed element covering the full width and height of the window overlays the whole page.
- What is the usual way for JavaScript to hide or show a component such as a modal box?
- Delete the HTML file
- Add or remove a CSS class that sets display: none or display: block
- Reload the page
- Change the doctype
Show answer
Add or remove a CSS class that sets display: none or display: block. Toggling a class keeps the styling in the CSS and is easy to reverse.
- A filter list should update as the user types each letter into the search box. Which event should the handler use?
- load
- submit
- dblclick
- keyup
Show answer
keyup. keyup fires after every key, once the box's value has changed.
- What is displayed when this code runs?
```js
const items = ["Yoga", "boxing", "Aqua", "Spin"];
items.sort();
console.log(items.join(" "));
```
Show answer
Aqua Spin Yoga boxing. sort() compares character codes, so capitals come before lower case: Aqua Spin Yoga boxing. Use localeCompare or toLowerCase to sort ignoring case.
- Why does an openTab function hide every panel before showing the chosen one?
- Because classList cannot remove classes
- To make the page load faster
- Because panels must be deleted first
- So only one panel is ever visible, whichever was open before
Show answer
So only one panel is ever visible, whichever was open before. Hiding all first guarantees exactly one visible panel.
Sources
- Pearson Edexcel International Advanced Subsidiary/Advanced Level in Information Technology specification (first teaching 2018), Unit 2 Topics 7 to 11
- Pearson qualifications: Edexcel International Advanced Level Information Technology (2018)
- Pearson WIT12/01 examiner report, June 2025 series
- Pearson WIT12/01 mark scheme, June 2024 series
Last updated 8 November 2026. Spotted a mistake? Tell us.