Files

36 lines
830 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Local Site — Hash</title>
<link rel="stylesheet" href="assets/site.css">
</head>
<body>
<header>
<h1>Hash Page</h1>
<nav><a href="index.html">Home</a></nav>
</header>
<main>
<h2 id="section-1">Section 1</h2>
<p>Jump to <a href="#section-2">section 2</a> or
<a href="#section-3">section 3</a>.</p>
<h2 id="section-2">Section 2</h2>
<p>You arrived at section 2. The URL fragment should be
<code>#section-2</code>.</p>
<h2 id="section-3">Section 3</h2>
<p>End of the page.</p>
<p>Current hash: <span id="hash-out"></span></p>
</main>
<script>
function report() {
document.getElementById('hash-out').textContent = location.hash || '(none)';
}
report();
window.addEventListener('hashchange', report);
</script>
</body>
</html>