Links within pages
Although long pages are generally not a great idea there are occasions when you want one. You might want to put a long report on the Web for example. You could break the report into a page for each section but you might prefer it to look as much like the printed version as possible. If you do that it would be good if the reader could jump to various places in the document quickly. Example long page
To create a link within a page there are two stages. First put an ID attribute where you want the link to lead (probably in a heading tag). This will act like a bookmark:
<h2 id="section3">3. Project Schedule</h2>
Then you create that link to that anchor (the # tells the browser this is an internal link:
<a href="#section3">Section 3. Project Schedule</a>
You would normally then provide a link to get the reader back to the top.
Links to specific parts of other pages
Using the technique for internal links you can link directly to a particular place in another page:
<a href="longpage.html#section3">Section 3. Project Schedule</a>
Keyboard shortcuts to links
These techniques are intended for people who cannot use a mouse. They work differently depending on OS and browser so do not rely on them too much.
It is possible to use the keyboard tab key to move through the links on a page. Once the link has the focus pressing the space key will normally activate it.
Changing the tab order
The browser will let the user tab through links in the order they appear. Instead you can set the tab order manually:
<a href="fred.html" tabindex="2">a link to fred</a>
<a href="fred.html" tabindex="1">another link to fred</a>
Create a set of links with a strange tab order and test it.
Shortcut keys
Rather than tabbing through lots of links you can jump to any one. It is easy to provide shortcuts to links:
<a href="fred.html" accesskey="f">a link to fred</a>
Load that in a browser and press and hold the ALT key (Microsoft systems - other OSs use other keys) and then press the f key on your keyboard. This will only work if the page has the focus. Otherwise your browser will think the message is to it and will activate its own menu. Some browsers will load the linked page immediately while others will need the user to press the space key to trigger the activation.




