473,756 Members | 3,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem specifying path for images in Javascript slideshow

It's probably something simple, but I just can't find the solution.

I'm using the javascript slideshow code at
http://javascript.internet.com/misce...lide-show.html
for a slideshow on a webpage.

Right now I'm prototyping the page on my computer, and eventually it'll
move to the server.

The script works fine when the images are in the same folder as the
html file, but when I move the images off to sub-folders it doesn't
find them.

I've tried changing the values for filenames in the array to include
the path, but it doesn't work.

I've tried
Pic[0] = 'images\interio rs\1.jpg'
Pic[1] = '\images\interi ors\2.jpg'

The "images\interio rs\" path is just off the folder that the html files
are stored in.

Is there something I'm missing here?

TIA,
Buster

Oct 7 '05 #1
6 1924

buster...@gmail .com wrote:
It's probably something simple, but I just can't find the solution.

I'm using the javascript slideshow code at
http://javascript.internet.com/misce...lide-show.html
for a slideshow on a webpage.

Right now I'm prototyping the page on my computer, and eventually it'll
move to the server.

The script works fine when the images are in the same folder as the
html file, but when I move the images off to sub-folders it doesn't
find them.

I've tried changing the values for filenames in the array to include
the path, but it doesn't work.

I've tried
Pic[0] = 'images\interio rs\1.jpg'
If directory with the images are a subdirectory of the current page,
then this is the correct one to use.
Pic[1] = '\images\interi ors\2.jpg'
This one is an absolute path which starts from the root.

The "images\interio rs\" path is just off the folder that the html files
are stored in.

Is there something I'm missing here?
Yes, all you're doing is setting string values to arrays. What you
wanted is more like the following:

Pic[0].src = "images/interiors/1.jpg";
....
Pic[n].src = "path/n.jpg";

TIA,
Buster


Oct 7 '05 #2
>> Is there something I'm missing here?
Yes, all you're doing is setting string values to arrays. What you wanted is more like the following:
Pic[0].src = "images/interiors/1.jpg";
...
Pic[n].src = "path/n.jpg";


The script is using that array to then set the property...
....
preLoad[i].src = Pic[i];
....
img src="images\int eriors\Picture1 a.jpg" name='SlideShow ' width=350
(brackets removed just for post)
....

Initially, the webpage loads the src that's manually set in the image
take. Then, the javascript take over and changes the scr and reloads
the image. It's when the Javascript takes over that it doesn't grab
the picture.

The javascript works fine if I just keep the images in the same folder.
Weird.

Buster

Buster

Oct 7 '05 #3
<bu*******@gmai l.com> wrote in message news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
img src="images\int eriors\Picture1 a.jpg" name='SlideShow ' width=350


That would be interpreted probably as: imagesinteriors Picture1a.jpg

You can read about character escaping here:
http://developer.mozilla.org/en/docs...ers_in_Strings

Notwithstanding that, it's easier and always acceptable to specify paths
using forward slashes, as they do not need to be escaped.

--
S.C.


Oct 8 '05 #4
Stephen Chalmers said the following on 10/7/2005 8:42 PM:
<bu*******@gmai l.com> wrote in message news:11******** **************@ g14g2000cwa.goo glegroups.com.. .

img src="images\int eriors\Picture1 a.jpg" name='SlideShow ' width=350

That would be interpreted probably as: imagesinteriors Picture1a.jpg


Close but it would be imagesnteriorsi cture1a.jpg without the first
letter of interiors and Picture1a.

The \ would escape the i and P and in the process they get lost.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 8 '05 #5
Randy Webb <Hi************ @aol.com> wrote in message news:2e******** ************@co mcast.com...
Stephen Chalmers said the following on 10/7/2005 8:42 PM:
<bu*******@gmai l.com> wrote in message news:11******** **************@ g14g2000cwa.goo glegroups.com.. .

img src="images\int eriors\Picture1 a.jpg" name='SlideShow ' width=350

That would be interpreted probably as: imagesinteriors Picture1a.jpg


Close but it would be imagesnteriorsi cture1a.jpg without the first
letter of interiors and Picture1a.

The \ would escape the i and P and in the process they get lost.


Closer than you think; the i and P cannot be escaped, so they remain in place.

--
S.C.
Oct 8 '05 #6
So this ended up working...
Pic[0] = 'images\\interi ors\\Picture1.j pg'
Pic[1] = 'images\\interi ors\\Picture2.j pg'
Pic[2] = 'images\\interi ors\\Picture3.j pg'
Pic[3] = 'images\\interi ors\\Picture4.j pg'
Pic[4] = 'images\\interi ors\\Picture5.j pg'
Pic[5] = 'images\\interi ors\\Picture6.j pg'

Thanks for the help.

Buster

Oct 10 '05 #7

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

Similar topics

8
2038
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large images of the thumbnails. When the slideshow begins it always starts with the first image. I would like to pass the name of the thumbnail to the slideshow HTML page and begin the slideshow with the same image the user clicks on. Is this asking...
11
3102
by: designkitt | last post by:
Hello, I am having a problem aligning a cell in a table and have tried everything I can think of to correct this without any luck: It appears that the white area, which is an image in the background of this table within a table is shifted slightly to the right. It's driving me crazy. Any help would be greatly appreciated. Here is the url and the code for the whole page: http://kittelbergerdesign.com/indextest.html <html> <head>...
1
3348
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those images. I have try with the following jsp code. <%@ page language="java" %> <%@ page import="java.sql.*"%> <%@ page import="java.sql.Connection.*"%> <%@ page import="java.awt.image.*"%>
1
7486
by: maarten2002 | last post by:
Hi people, I am quite new to JS-scripting and I have a question. Finally I found a "good" slideshow which works in IE, Chrome, FF with prototype. The only thing is that I would like the slideshow to stop when the mouse is over the slideshow and start again when the pointer leaves the pics. Thanks alot in advance! Already found something, but don't know how to implement it:
0
9273
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9711
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7244
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5141
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5303
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.