Web Analytics Made Easy -
StatCounter Remote control of Gallery - CodingForum

Announcement

Collapse
No announcement yet.

Remote control of Gallery

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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; Jun 18, 2002, 10:13 PM.
    Former ASP Forum Moderator - I'm back!

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

    Comment


    • #3
      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

      Comment


      • #4
        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. ;)

        Comment


        • #5
          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
          FootballHangout.com

          Comment


          • #6
            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

            Comment

            Working...
            X