By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Random image with duplicate checker

P: n/a
I need a Javascript function that will display X random images on a
page that also doesn't display the same image twice.

Bonus points if it grabs the max array from the folder and sets it.
Even more points if it grabs all the image names from the folder.

Thanks in advance!

Sep 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JRS: In article <11**********************@d34g2000cwd.googlegroups .com>,
dated Mon, 18 Sep 2006 15:01:24 remote, seen in
news:comp.lang.javascript, KoRnDragon <ko********@gmail.composted :
>I need a Javascript function that will display X random images on a
page that also doesn't display the same image twice.
Then they are not random. See FAQ 4.22 and its final link.
>Bonus points if it grabs the max array from the folder and sets it.
Even more points if it grabs all the image names from the folder.
Under normal security, Web Javascript has no such access to folders. If
the image folder on the server has no default page, you might be able to
access it in to another frame or window as a directory and read that by
Javascript. ISTM better to use a process on the authoring or serving
machine to produce a list of image names; or to name the images
systematically, e.g. pic0000.gif to pic0121.gif.

In the latter case, you need only determine the number (N) of images
available, deal X of N, and use the results to generate the names
directly; otherwise to index a name array.

It's a good idea to read the newsgroup and its FAQ.
--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Sep 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.