For Each Question

J

J.Evans.1970

I never used JavaScript before and am not sure how to do something. I
am a programmer and use VBScript, so I am familiar with programming
terminology - just not javascript.

I found some cool free code on the internet for a slide show on a
website and want to modify it. In the script it appears to require you
to enter each picture directly. What I would like to do is use a for
each...next loop and create a slideshow for each picture in the folder.
Would someone here mind explaining the correct way to do this? The
code to add an individual picture is below. I just need to know how to
modify it.

Thanks!
Jennifer

s = new slide();
s.src =
"http://www.freewebs.com/hannahshope/images/HannahCoulterLR.jpg";
s.text = unescape("");
s.link = "";
s.target = "";
s.attr = "";
s.filter = "";
SLIDES.add_slide(s);
 
M

Martin Honnen

I never used JavaScript before and am not sure how to do something. I
am a programmer and use VBScript, so I am familiar with programming
terminology - just not javascript.

Then you need to start learning it
<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide>
I found some cool free code on the internet for a slide show on a
website and want to modify it. In the script it appears to require you
to enter each picture directly. What I would like to do is use a for
each...next loop and create a slideshow for each picture in the folder.

What folder? Is that a script used on the server with classic ASP?
Client-side script in the browser (whether it is JavaScript or VBScript
does not matter) usually does not have access to the file system to find
folders or files in folders.
 
O

Octo Mancer

I never used JavaScript before and am not sure how to do something. I
am a programmer and use VBScript, so I am familiar with programming
terminology - just not javascript.

I found some cool free code on the internet for a slide show on a
website and want to modify it. In the script it appears to require you
to enter each picture directly. What I would like to do is use a for
each...next loop and create a slideshow for each picture in the folder.
Would someone here mind explaining the correct way to do this? The
code to add an individual picture is below. I just need to know how to
modify it.

Thanks!
Jennifer

s = new slide();
s.src =
"http://www.freewebs.com/hannahshope/images/HannahCoulterLR.jpg";
s.text = unescape("");
s.link = "";
s.target = "";
s.attr = "";
s.filter = "";
SLIDES.add_slide(s);

This is untested but should get you started even if it's not perfect.

var slide_src = new Array(
'http://www.freewebs.com/hannahshope/images/HannahCoulterLR.jpg',
'http://some.other.domain/pic.jpg',
etc
);
for(i=0;i<slide_src.length;i++) {
s = new slide();
s.src = slide_src;
s.text = unescape("");
s.link = "";
s.target = "";
s.attr = "";
s.filter = "";
SLIDES.add_slide(s);
}

Rich
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top