Simple Prev/Next Navigation

S

saturnius

Hi,
I would like to have a navigation menu with prev/next in a top frame
and in the main frame a PDF file.
I think this might be possible with JavaScript:
- get current file name
- go to next prev in the list of 10 files

Unfortunately I do not know JavaScript - that's why my post.... ;-)
Could anybody point me in the right direction please?

Cheers
Saturinus
 
B

Bart Van der Donck

saturnius said:
I would like to have a navigation menu with prev/next in a top frame
and in the main frame a PDF file.
I think this might be possible with JavaScript:
- get current file name
- go to next prev in the list of 10 files

Here are 4 files in a same directory (cross-frame scripting will need
the same domain anyhow). These should help you - just open index.htm
then.

--------------
index.htm
--------------
<html>
<head>
<frameset rows="70,*">
<frame name="top" src="top.htm">
<frame name="main" src="down.htm">
</frameset>
</head>
<body>
</body>
</html>

--------------
top.htm
--------------
<html>
<body>
<form>
<center>
<input type="button" value="Back"
onClick="parent.frames['main'].history.go(-1)">
<input type="button" value="Forward"
onClick="parent.frames['main'].history.go(+1)">
</center>
</form>
</body>
</html>

--------------
down.htm
--------------
<html>
<body>
<p>this is down.htm</p>
<p>go to <a href="down2.htm">down2.htm</a></p>
</body>
</html>

--------------
down2.htm
--------------
<html>
<body>
<p>this is down2.htm</p>
</body>
</html>

I'm not sure what you mean by "go to next prev in the list of 10
files". Actually, you can go back and forward to any file in in your
browser's window as long as it's present.

Example:
<input type="button" value="Go back 5 pages"
onClick="parent.frames['main'].history.go(-5)">
will get you back five pages (that is, if you had already visited 5
pages before invoking the script).

I don't see why you would need the current filename as you wrote.
Anyway, here it is:

<html>
<body>
Your current full file name = <br>
<script language="javascript">
document.write(location.href);
</script>
</body>
</html>
 

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,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top