In the following site
http://support.apple.com/kb/ht1574
There is a hyperlink with the text " How to redeem an iTunes Gift Card
on a computer"
It looks like a link, but it's not a real link, in the full meaning of
the word. Disable JavaScript in your browser and try again to see that
the "link" does not work.
When you click on it, it reveals some more text which disappears on
the next click.
I inspected the code to figure out how this is done but was unable to
isolate the required code.
It's rather simple though slightly obfuscated by various complexities.
The text revealed is part of the document's content, just placed in an
element that is hidden with CSS (display: none is one simple way of
hiding, and it's what the page uses). When you click on the "link", then
(if JavaScript is enabled), the CSS settings for the element are changed
and it becomes visible. Clicking it again changes the status back.
A fundamental design flaw with this is that when CSS is enabled and
JavaScript is not, the information is not available at all to the user.
A more robust way would be something like this:
<div class=stuff>
<h2>How to do something</h2>
<div class=howto>
This is how to do it, in detail.
</div>
</div>
Works fine, doesn't it? If you want to hide the detailed explanation
initially and make it available only via clicking on the heading
(assuming the user realizes he needs to do that! you might wish to style
the heading in a link-like manner for that), you should ensure that
hiding only takes place when revealing is possible.
This means that you would add some relatively simple JavaScript code
that traverses the document, recognizes elements that have class=stuff,
assigns an onclick handler to the h2 element inside any such element and
sets the display property of any element with class=howto to 'none'. The
onclick event handler would then just toggle that display property value
between 'none' and 'block'.
It's not that complicated, and I would say that if you don't know how to
do that (and don't want to learn that), you shouldn't do it - just
copying such code without understanding how it works tends to hurt,
sooner or later.