473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Javascript Photo Slideshow

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('blackandwhit e',currentpicture_blackandwhite-1)"><--</a>
| <a
href="javascript:displayPictureFrame('blackandwhit e',currentpicture_blackandwhite+1)">--></a>
</td>
</table>
---------------------------------------------------------------------
Implementation:
http://www.ryankavalsky.com/pictures/pictures_test.htm
---------------------------------------------------------------------
Thanks!

Mar 8 '06 #1
2 1889
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.

Mar 8 '06 #2
The source code is at
http://www.ryankavalsky.com/include/...ictureframe.js
and the code in action is at http://www.ryankavalsky.com/pictures. :)

Mar 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
5
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide,...
6
by: Dan Webb | last post by:
Hi All, Im currently working on ways of pacakaging javascript functions/variables/objects in a similar way to the Java package statement so that scripts can be interact with each other with the...
4
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to...
5
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas...
22
by: bevoldjling | last post by:
Hi ! I need some help in putting together a website for our family gathering. Although I'm still pretty "green", I don't think what I need requires terribly advanced skills ...except for one...
1
by: gencode | last post by:
I have this bit if javascript and it animates an image well, the problem is that the more it runs the more memory it eats on the client machine. Can anyone help me make this not eat all avaliable...
3
by: Gaby Sandoval | last post by:
I have a very simple javascript slideshow. It is extremely basic (see small sample below): <script language="JavaScript1.1"> <!-- //specify interval between slide (in mili seconds) var...
0
by: jasper98 | last post by:
Hi all, I've got a big problem trying to combine javascript with xml. I am using the Flash Slideshow Maker: http://www.flash-slideshow-maker.com/ to make some nice photo galleries, but they've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.