Simple Prev/Next Navigation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • saturnius

    Simple Prev/Next Navigation

    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
  • Bart Van der Donck

    #2
    Re: Simple Prev/Next Navigation

    saturnius wrote:
    [color=blue]
    > 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[/color]

    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="javas cript">
    document.write( location.href);
    </script>
    </body>
    </html>

    --
    Bart

    Comment

    Working...