arrays for slideshow

P

PETE

hi folks,

copied a handy little slideshow script that works fine, but placing the
slideshow in a dreamweaver template, then creating HTML "child" files in
sub-folders, renders the array's path invalid. function runs from an
external JS file.

array element is like this:

Pic[0] = 'images/slideshow/0.jpg' ... etc

thought I could put in the fwdslash in the path like this:

Pic[0] = '/images/slideshow/0.jpg' ... etc

but it does not work.

any way of denoting the path in JS so that it will always be relative to
root?

thanks,

PG
 
E

Evertjan.

PETE wrote on 27 dec 2008 in comp.lang.javascript:
copied a handy little slideshow script that works fine, but placing
the slideshow in a dreamweaver template, then creating HTML "child"
files in sub-folders, renders the array's path invalid. function runs
from an external JS file.

array element is like this:

Pic[0] = 'images/slideshow/0.jpg' ... etc

thought I could put in the fwdslash in the path like this:

Pic[0] = '/images/slideshow/0.jpg' ... etc

but it does not work.

any way of denoting the path in JS so that it will always be relative
to root?

A string can never be relative to the root.

It depends on how [== in what code] you use such string.

And what is a "dreamweaver template",
the fabric that dreams are made of
or an ancient sort of javascript?

try:

======================================
<img src='/startPic.jpg' id='imgA'>

<script type='text/javascript'>

var pic = ['/images/slideshow/0.jpg','/images/slideshow/2.jpg'];

document.getElementById('imgA'),src = pic[0];

</script>
======================================
 
T

Thomas 'PointedEars' Lahn

PETE said:
thought I could put in the fwdslash in the path like this:

Pic[0] = '/images/slideshow/0.jpg' ... etc

but it does not work.

any way of denoting the path in JS so that it will always be relative to
root?

This *is* a path that is relative to the (document) root of a Web server or
Virtual Web Host. It is a URI thing, though, not a JS thing. See RFC 3986.

However, it is possible that the slideshow script that you are relying on
uses this string value only as part of the actual URI-reference. If so, you
would need to adapt this script. As a rule of thumb, though, avoid code
provided by Dreamweaver for its bad quality.

The Message-ID header of your posting is invalid; the domain part should be
a FQDN so as to minimize the chance of collisions up to two years from the
posting date. Your supposed user agent (Outlook Express 6.00.2900.5512) is
not known to make that kind of mistake (but others[1]); please inform your
news server administrator about it instead.


PointedEars
___________
[1] <http://insideoe.com/>
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top