By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,567 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,567 IT Pros & Developers. It's quick & easy.

Getting Next / Previous from a text file

P: n/a
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.

Oct 25 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.