The example below is one way of implementing stretchtext in
Netscape 4. For more detail,
you can have a look at the code, but basically it does the following:
Each block of text to appear or disappear is enclosed in
<span>
tags, and assigned a unique id
.
The script below checks the search
part of the document's
URL. If it is ?1
, all of the detail blocks are shown.
Otherwise, it is assumed that the page should be displayed in low
detail and the blocks of detail are not shown.
One of the advantages of this method is that this page looks pretty good in non-JavaScript browsers. The only problem is that there is an "It" that is shown only in lower detail versions of the pages, that looks a little out of place without scripts and CSS. This problem, while not too major, could be remedied by writing out the "It" using a script.
The main disadvantage of this method is that each block of text to
be expanded has to have a unique id
attribute. For long
blocks of text, this would make the script hopelessly long (have a look
at the script if you don't believe me). For fairly short blocks of
text, though, it works fine.
The following paragraph is the Stretchtext example from page 134 of Dream Machines (1987 edition), by Ted Nelson. To view a more detailed or less detailed version of it, select the "More detail" or "Less detail" link (there are only two levels of detail so only one of the above needs to be displayed at a time) or select the up or down arrows at the bottom of the page.
Stretchtext, a kind of hypertext, is basically a form of writing closely related to other prose. It is read by a user or student from a computer display screen. The user, or student, controls it, and causes it to change, with throttles connected to the computer. ItStretchtext gets longer, by adding words and phrases, or shorter, by subtracting words and phrases, on demand.