just put each of your "pages" into DIVs with the display attribute set to
'none'. Then use your links to invoke a function which hides the currently
visible section and displays the desired section.
e.g.
<SCRIPT LANGUAGE="javascript">
//Frist create the links
for(var n=1;n<=30;n++)
document.write('<A HREF="javascript:showPage('+n+');">Page
'+n+'</A> ');
var iCurrentPage=0;
function showPage(i){
if(iCurrentPage>0)
document.getElementByID("page"+iCurrentPage).style.display="none";
iCurrentPage=i;
document.getElementByID("page"+i).style.display="none";
}
</SCRIPT>
<DIV ID="page1" STYLE="display:none;">
...page 1 content ...
</DIV>
<DIV ID="page2" STYLE="display:none;">
...page 2 content ...
</DIV>
<DIV ID="page3" STYLE="display:none;">
...page 3 content ...
</DIV>
<DIV ID="page4" STYLE="display:none;">
...page 4 content ...
</DIV>
...etc...
-----Original Message-----
From: UKBen [mailto:bmf1@u...]
Sent: 27 August 2001 21:54
To: JavaScript HowTo
Subject: [javascript_howto] Creating new "pages" within one large .htm
page
Hi!
I need to produce a long document which will be saved as one .htm page.
Another .htm page will contain say 30 links to different points on the
other .htm page at regular intervals from top to bottom.
Is it possible to have a user click on any link and for the relevant
section of the long page to be called so that the user thinks he/she is
only looking at one page containing only the relevant section's
information and nothing else? I know I can navigate to different sections
using html only by linking <a href=page.htm#link1> to <a name=link1> but
you can still see the preceeding and trailing information from other
sections on the same page using this method!!! Before you ask, no, I can't
just have 30 .htm files with one page per subject, it has to all be on one
page.
I hope I've made my point clear - it's difficult to explain using words
but with a pad and pencil I'd be there in seconds.......
Hope someone can at least point me in the right direction to look.
Thanks