Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remote control of Gallery

    Got given most of this script for a gallery I'm setting up, you click a button on a page and the code works out the current doc name and adds a number to the end... i.e. was page1.html, when you click next it takes you to page2.html. You have to put in the number of pages of course, so it knows if you get to page7.html it should stop....

    Anyway, my gallery displays a page1.html in a <iframe>, and the controls are on the parent doc.... I've tried codeing every which way but i'm a tool and missing it completely....

    here it is...

    var txt = document.viewer.location.toString()
    parts = txt.split("/");
    path = parts[(parts.length-1)];
    path = path.split(".");
    doc = path[0];
    docext = path[1];
    docname = doc.replace(/\d/g,'');
    docnumber = Number(doc.replace(/\D/g,''));

    function goback(){
    if (docnumber!=0){ // replace 0 with your first page!
    document.viewer.location = "gallery/"+docname+(docnumber-1)+"."+docext;
    }
    }

    function goforward(){
    if (docnumber!=3){ // replace 3 with your last page!
    document.viewer.location = "gallery/"+docname+(docnumber+1)+"."+docext;
    }
    }

    </head><body>

    <iframe name="viewer" src="gallery/page0.html"><iframe>

    <input type="button" onclick="goforward()" value="next">
    <input type="button" onclick="goback()" value="back">

    //I'm pretty sure the problem resides in the docnumber check,
    //But it is a little over my head......

    //Thanks for the help...

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The code wasn't written to use with iframes (I know, I wrote it... and tried to shorten the code using the slice() method before finding a bug in IE 4.0, and figured "why fix it if it ain't broke?"), but I can modify it to work with an iframe... however that would require looking at your code!

    Can you supply a URL to the page?
    Last edited by whammy; 06-19-2002 at 04:13 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by whammy
    tired
    /me just a whispers® to wha...
    trusting it is the type of just a ccomplishmInt® hehehe...the new n' improved db seems to have just a worked® perrrfectly...:O)))
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good deal... heck you did most of the work.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    It's a gallery but you want to link pages and not images?
    can I suggest another way?
    put your images in an array
    instead of the iframe make a GIANT button
    now the face of that button will be your image

    you can put your forward and back buttons to be
    one more or one less in the array

    if that's no good
    what immediately hit me was you're missing a "parent" in your code, it probably can't find the iframe
    and try location.href


    sorry, tired too
    hope this is of some help if even just an idea

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by whammy
    Good deal... heck you did most of the work.
    wha...
    work??? just a rotflmao®...ohhh you meant just a greatjob® of copy/paste/edit/save/pray :O)))
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •