Javascript Photo Slideshow

Discussion in 'Javascript' started by Ryan, Mar 8, 2006.

  1. Ryan

    Ryan Guest

    Howdy. I'm writing a photo slideshow in javascript (using js to make
    it more user-universal). I have the functions set up to get a photo
    thumb from an array and link it to its larger counterpart, opening it
    in another window. That works well, but when I call the function again
    to write the next picture, document.write puts it in it's own page. I
    want it to write the next picture where the first one was. Any
    thoughts?
    ---------------------------------------------------------------------
    Simplified Code:
    var blackandwhite = new Array(); // all black and white pictures

    var pathlarge = "large/";
    var paththumb = "thumb/";

    var currentpicture = 0;
    var currentpicture_blackandwhite = 0;

    // Fill the arrays with pictures
    blackandwhite[0] = "/blackandwhite/test.jpg";
    blackandwhite[1] = "/blackandwhite/test2.jpg";

    function displayPictureFrame(albumToDisplay, currentpicture)
    {
    if (albumToDisplay == "blackandwhite")
    {
    currentpicture_blackandwhite = currentpicture;
    document.write("<a href=" + pathlarge +
    blackandwhite[currentpicture_blackandwhite] + " target=_blank><img
    src=" + paththumb + blackandwhite[currentpicture_blackandwhite] + "
    border=0></a>");
    }
    else
    {
    document.write("No picture frame selected...");
    }
    }
    ---------------------------------------------------------------------
    HTML Call:
    <table width="100%">
    <td width="25%" align="center" valign="middle" bgcolor="#006699">
    <script>displayPictureFrame('blackandwhite', 0);</script>
    <br><a
    href="javascript:displayPictureFrame('blackandwhite',currentpicture_blackandwhite-1)"><--</a>
    | <a
    href="javascript:displayPictureFrame('blackandwhite',currentpicture_blackandwhite+1)">--></a>
    </td>
    </table>
    ---------------------------------------------------------------------
    Implementation:
    http://www.ryankavalsky.com/pictures/pictures_test.htm
    ---------------------------------------------------------------------
    Thanks!
     
    Ryan, Mar 8, 2006
    #1
    1. Advertising

  2. Ryan

    Ryan Guest

    Alright, I got it. You just use a div, assign it an id, and write to
    that specific div and not the page. If anyone wants the code, it'll be
    at www.ryankavalsky.com/pictures.htm or around there somewhere.
     
    Ryan, Mar 8, 2006
    #2
    1. Advertising

  3. Ryan

    Ryan Guest

    Ryan, Mar 9, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    2
    Views:
    506
    John M Deal
    Nov 24, 2004
  2. Carol Carrot

    search engine - javascript slideshow

    Carol Carrot, Aug 25, 2004, in forum: ASP General
    Replies:
    0
    Views:
    107
    Carol Carrot
    Aug 25, 2004
  3. Jeannie
    Replies:
    2
    Views:
    189
    Jeannie
    Apr 12, 2004
  4. CB US 77

    Captions for Javascript slideshow

    CB US 77, Jul 16, 2004, in forum: Javascript
    Replies:
    3
    Views:
    117
    Thomas 'PointedEars' Lahn
    Jul 18, 2004
  5. UKAde

    Javascript slideshow

    UKAde, Jul 13, 2005, in forum: Javascript
    Replies:
    6
    Views:
    96
Loading...

Share This Page