Getting Next / Previous from a text file

R

Reb

Hi all,

I have not successfully found a Javascript sample for getting next and
previous links from a file... I figured that someone must have solved
this problem already! ... here is what I'm trying to do.

I have a multi-framed file, with navigation in a top bar. Within each
content directory, I have a file called nav.txt that lists the files in
order. I'd like my next and previous buttons to be able use the nav.txt
file to determine which file should be loaded when the button is
clicked.

Alternatively, I'd like to be able to have JavaScript parse the
directory structure, and based on an alphabetical listing of file names
automatically generated the next and previous.

Does anyone have sample java script snippets that do this?


Thanks
Reb.
 
R

Randy Webb

Reb said the following on 10/25/2006 3:04 PM:
Hi all,

I have not successfully found a Javascript sample for getting next and
previous links from a file... I figured that someone must have solved
this problem already! ... here is what I'm trying to do.

I have a multi-framed file, with navigation in a top bar. Within each
content directory, I have a file called nav.txt that lists the files in
order. I'd like my next and previous buttons to be able use the nav.txt
file to determine which file should be loaded when the button is
clicked.

Make your nav.txt a JS file that contains an array of all the file names
you want included. Or, simply name them in order - page001, page002,
page003 etc.. - and then in the last page put a JS marker to tell it
last page:

var lastPage = true;

Then, it can simply extract the current files name and determine
previous and next based on lastPage and whether there is a previous page
or not.
Alternatively, I'd like to be able to have JavaScript parse the
directory structure, and based on an alphabetical listing of file names
automatically generated the next and previous.

JS - on the client - can't read the directory structure on the server.
The closest it could do would be to read an FTP listing in a hidden
IFrame and parse out the file names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top