Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _data/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,7 @@ chlopecki:
- label: "GitHub"
icon: "fab fa-fw fa-github"
url: "https://github.com/anchlopecki"

jonathanowentj:
name: "JonathanOwenTJ"
bio: "Maintains a Chinese-language directory of learning and creative resources."
77 changes: 77 additions & 0 deletions _posts/2026-12-01-local-arithmetic-html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "A Small Local Arithmetic Practice Page with Plain HTML"
description: "Build a two-question self-checking arithmetic activity with ordinary form controls and a short script."
tags: accessibility HTML JavaScript learning
author: jonathanowentj
comments: true
---

A short self-checking activity can make arithmetic practice easier to reuse. It does not need a learning platform, an account, or a server to check the answers. Here is a deliberately small example: one addition question, one multiplication question, and feedback that changes when the learner checks their work.

This is a starting point for a teacher or resource creator, not an assessment system. It does not record results, generate questions, or replace a discussion about how an answer was reached. The example works as a local HTML file and does not load external libraries.

## Make the activity

Save the following as `math-practice.html`, then open it in a browser. Enter answers for both questions and choose **Check answers**. Try leaving a field blank, entering two correct answers, and then changing one answer before checking again.

```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Two arithmetic checks</title>
</head>
<body>
<main>
<h1>Practice: add and multiply</h1>
<p>Enter an answer for each question, then choose Check answers.</p>
<form id="practice">
<p><label for="addition">1. What is 8 + 5?</label>
<input id="addition" type="number" inputmode="numeric"></p>
<p><label for="multiply">2. What is 3 × 4?</label>
<input id="multiply" type="number" inputmode="numeric"></p>
<button type="submit">Check answers</button>
</form>
<p id="result" role="status" aria-live="polite"></p>
<noscript>JavaScript is needed to check the answers; you can still solve the questions on paper.</noscript>
</main>
<script>
const form = document.querySelector('#practice');
const result = document.querySelector('#result');
const questions = [
{ input: document.querySelector('#addition'), answer: 13 },
{ input: document.querySelector('#multiply'), answer: 12 }
];
form.addEventListener('submit', (event) => {
event.preventDefault();
const missing = questions.filter(({ input }) => input.value.trim() === '').length;
if (missing) {
result.textContent = `Please answer all questions. ${missing} still blank.`;
return;
}
const score = questions.filter(({ input, answer }) => Number(input.value) === answer).length;
result.textContent = `${score} of ${questions.length} correct. You can revise your answers and check again.`;
});
</script>
</body>
</html>
```

The questions are fixed in the page so that the example is easy to inspect. Each input has a visible label; the result has `role="status"` and `aria-live="polite"` so assistive technology can announce updated feedback without moving focus. The form has a real submit button, so it can also be submitted using the keyboard. The `noscript` message explains the limitation if JavaScript is unavailable.

The script first checks for blank fields. This matters because JavaScript converts an empty string to zero when using `Number()`. Only after both fields have values does it compare each numeric answer to the expected answer. Feedback reports a total and invites another attempt; it does not claim to explain why a response was incorrect.

## Adapt it for a lesson

Change the visible question and its corresponding `answer` together. For example, replace “8 + 5” with “9 + 6” and change `13` to `15`. Start with whole-number answers: decimal rounding and equivalent fractions need a different comparison rule. If you add a question, include both a labelled input in the form and a corresponding entry in the `questions` array.

You could also replace the total with feedback for individual questions, or add a hint after an incorrect response. Keep hints separate from the answer and check that each input still has a clear label. If the page is going to be used with a class, avoid adding student names or analytics unless there is an established reason and an appropriate data policy. This example itself sends no answers to a server; a hosting provider can still keep ordinary access logs.

## Check before sharing

Test the blank, correct, and incorrect cases. Then try the activity using only the keyboard and, where available, with a screen reader. Announcements can vary between browser and assistive-technology combinations, so the `role` and `aria-live` attributes alone are not a guarantee of accessibility. If you distribute the file, open the exact copy you intend to share and repeat the check.

For more detail, the MDN references for [form labels](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label), [form submission](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event), and [ARIA live regions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions) explain the underlying browser features.

*Author: JonathanOwenTJ operates [Resource Planet](https://resources.packscena.com/), a Chinese-language directory of learning and creative resources, including school supplementary materials. AI assisted with drafting this article and example; the example was checked locally for blank, correct, incorrect and retry cases.*