Javascript Photo Slideshow

R

Ryan

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>
 

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
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top