PDA

View Full Version : Image paths inside JavaScripts



RufusB
Nov 20th, 2009, 03:48 AM
Hi All,

Although I have done a fair bit of html coding after taking several HTML courses, I have never become involved in JavaScript beyond adding the occasional pre-made script for a particular function.

Which is what I am trying to do at the moment. I want to insert a slide show into a page and have tried 2 scripts from Java Kit Scripts. Both are similar and I am having the same problem with both.

The problem: Inserting the image path. They both ask for the image path (naturally) and give the following examples:

===========================
Example 1:

//configure the paths of the images, plus corresponding target links
slideshowimages("food1.jpg","food2.jpg","food3.jpg","food4.jpg","food5.jpg")

============================
Example 2:
//ultimateshow[x]=["path to image", "OPTIONAL link for image", "OPTIONAL link target"]

ultimateshow[0]=['dinosour.gif', '', '']
ultimateshow[1]=['crow.gif', 'http://www.dynamicdrive.com', '_new']
=============================

But there is no reference to an "image" folder. I have tried inserting the folder name: "images/iss-bunker-1tn.jpg",

I have also tried leaving the word "images" out and also tried saving the related images in the same folder as the html coded pages. I have also tried using "shtml" pages. But nothing seems to work.

My lack of JavaScript knowledge is obviously the problem, but I would greatly appreciate some help.

Sincerely

RufusB :confused:

jmrker
Nov 20th, 2009, 05:21 AM
If using FF browser, are you getting any errors in 'error console'?

Post link to your problem so we might be able to evaluate the HTML/JS program.

dniwebdesign
Nov 20th, 2009, 06:30 AM
Where are the photos that you want to link to in the JavaScript located from the script?

It is the path from the script to the images that you want.

Example:


root
|-Folder1
|-Images
|-photo1.jpg
|-javascriptPage.html
|-Folder2
|-Images
|-Photo2.jpg

Say javascriptPage.html is the page you have your script on and you want to reference photo1.jpg. The path would be:

Images/photo1.jpg
Simple. Now say you want photo2.jpg in the Folder2. The path would be:

../Folder2/Images/Photo2.jpg
And so on.

../
The above in a directory will reference back one directory. :-)
Hope this helps and if it doesn't.... what else can I do?

RufusB
Nov 22nd, 2009, 11:13 AM
Hi jmrker and dniwebdesign,

Thank you for your replys. Sorry not to have gotten bacck sooner, but have not been well.

I solved the problem. I had accidentally inserted two full stops between the picture name and the gif (objects1..gif).

Don't ask me why. As soon as I opened the file tonight, I saw the error of my ways.

Thanks for trying.

RufusB :mad: