/    Sign up×
Community /Pin to ProfileBookmark

Can JS be used to count images?

Hello all,

I’m working on a photo gallery in which the images are named with numbers 1 through 30. When the next or previous button is hit I have a simple code that just adds or subtracts one from the source name and displays that new or previous image. However, to make the gallery loop back to the beginning I have a statement that uses a variable called imageCount, which now defined as 30.

What I’m wondering is if there is a Javascript I can use so that instead of having the imageCount defined, the script will be able to count the number of images in a folder and return that as the variable’s value?

Thanks you guys rock!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Aug 24.2006 — JavaScript can not read contents from a folder, you will need a serverside langauge for that.

Eric
×

Success!

Help @Jake_ym spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...