I’m really new to arrays and am looking to keep things efficient and simple (although what I’m asking for is a bit complex). I’ll try and phrase things from my psuedo-newb standpoint.
Thus far, I have this script:
[CODE]function ShowGallery(type, origin) {
if (type == ‘session’) {
var photos = new Array(‘gallery/2007_04_11_photo_small_01.jpg’, ‘gallery/2007_04_11_photo_large_01.jpg’, ‘gallery/2007_04_06_video_small_01.jpg’, ‘gallery/2007_04_06_video_large_01.flv’, ‘gallery/2005_07_12_photo_small_09.jpg’, ‘gallery/2005_07_12_photo_small_08.jpg’, ‘gallery/2005_07_12_photo_small_07.jpg’, ‘gallery/2005_07_12_photo_small_06.jpg’, ‘gallery/2005_07_12_photo_small_05.jpg’, ‘gallery/2005_07_12_photo_small_04.jpg’, ‘gallery/2005_07_12_photo_small_03.jpg’, ‘gallery/2005_07_12_photo_small_02.jpg’, ‘gallery/2005_07_12_photo_small_01.jpg’, ‘gallery/2005_07_12_photo_large_09.jpg’, ‘gallery/2005_07_12_photo_large_08.jpg’, ‘gallery/2005_07_12_photo_large_07.jpg’, ‘gallery/2005_07_12_photo_large_06.jpg’, ‘gallery/2005_07_12_photo_large_05.jpg’, ‘gallery/2005_07_12_photo_large_04.jpg’, ‘gallery/2005_07_12_photo_large_03.jpg’, ‘gallery/2005_07_12_photo_large_02.jpg’, ‘gallery/2005_07_12_photo_large_01.jpg’, ‘gallery/2005_05_01_photo_small_16.jpg’, ‘gallery/2005_05_01_photo_small_15.jpg’, ‘gallery/2005_05_01_photo_small_14.jpg’, ‘gallery/2005_05_01_photo_small_13.jpg’, ‘gallery/2005_05_01_photo_small_12.jpg’, ‘gallery/2005_05_01_photo_small_11.jpg’, ‘gallery/2005_05_01_photo_small_10.jpg’, ‘gallery/2005_05_01_photo_small_09.jpg’, ‘gallery/2005_05_01_photo_small_08.jpg’, ‘gallery/2005_05_01_photo_small_07.jpg’, ‘gallery/2005_05_01_photo_small_06.jpg’, ‘gallery/2005_05_01_photo_small_05.jpg’, ‘gallery/2005_05_01_photo_small_04.jpg’, ‘gallery/2005_05_01_photo_small_03.jpg’, ‘gallery/2005_05_01_photo_small_02.jpg’, ‘gallery/2005_05_01_photo_small_01.jpg’, ‘gallery/2005_05_01_photo_large_16.jpg’, ‘gallery/2005_05_01_photo_large_15.jpg’, ‘gallery/2005_05_01_photo_large_14.jpg’, ‘gallery/2005_05_01_photo_large_13.jpg’, ‘gallery/2005_05_01_photo_large_12.jpg’, ‘gallery/2005_05_01_photo_large_11.jpg’, ‘gallery/2005_05_01_photo_large_10.jpg’, ‘gallery/2005_05_01_photo_large_09.jpg’, ‘gallery/2005_05_01_photo_large_08.jpg’, ‘gallery/2005_05_01_photo_large_07.jpg’, ‘gallery/2005_05_01_photo_large_06.jpg’, ‘gallery/2005_05_01_photo_large_05.jpg’, ‘gallery/2005_05_01_photo_large_04.jpg’, ‘gallery/2005_05_01_photo_large_03.jpg’, ‘gallery/2005_05_01_photo_large_02.jpg’, ‘gallery/2005_05_01_photo_large_01.jpg’, ‘gallery/2003_07_28_photo_small_16.jpg’, ‘gallery/2003_07_28_photo_small_15.jpg’, ‘gallery/2003_07_28_photo_small_14.jpg’, ‘gallery/2003_07_28_photo_small_13.jpg’, ‘gallery/2003_07_28_photo_small_12.jpg’, ‘gallery/2003_07_28_photo_small_11.jpg’, ‘gallery/2003_07_28_photo_small_10.jpg’, ‘gallery/2003_07_28_photo_small_09.jpg’, ‘gallery/2003_07_28_photo_small_08.jpg’, ‘gallery/2003_07_28_photo_small_07.jpg’, ‘gallery/2003_07_28_photo_small_06.jpg’, ‘gallery/2003_07_28_photo_small_05.jpg’, ‘gallery/2003_07_28_photo_small_04.jpg’, ‘gallery/2003_07_28_photo_small_03.jpg’, ‘gallery/2003_07_28_photo_small_02.jpg’, ‘gallery/2003_07_28_photo_small_01.jpg’, ‘gallery/2003_07_28_photo_large_16.jpg’, ‘gallery/2003_07_28_photo_large_15.jpg’, ‘gallery/2003_07_28_photo_large_14.jpg’, ‘gallery/2003_07_28_photo_large_13.jpg’, ‘gallery/2003_07_28_photo_large_12.jpg’, ‘gallery/2003_07_28_photo_large_11.jpg’, ‘gallery/2003_07_28_photo_large_10.jpg’, ‘gallery/2003_07_28_photo_large_09.jpg’, ‘gallery/2003_07_28_photo_large_08.jpg’, ‘gallery/2003_07_28_photo_large_07.jpg’, ‘gallery/2003_07_28_photo_large_06.jpg’, ‘gallery/2003_07_28_photo_large_05.jpg’, ‘gallery/2003_07_28_photo_large_04.jpg’, ‘gallery/2003_07_28_photo_large_03.jpg’, ‘gallery/2003_07_28_photo_large_02.jpg’, ‘gallery/2003_07_28_photo_large_01.jpg’, ‘*’);
}
}
I have a div full of images and each image, when clicked, runs the function as follows (example):
[CODE]ShowGallery(‘session’, ‘2005_07_12’);
I want this function to find all images in the array with “2005_07_12” in it, as well as the word “small”.
Then I want for each file to be given the following html “casing” like this:
[CODE]<div class=”gallery_option”><div class=”gallery_thumb” style=”background: url(gallery/2005_07_12_photo_small_01.jpg) no-repeat;” onclick=”ShowGallery(‘photo’, ’01’);”></div></div>
Next, they all need to be combined into a single html string to be applied as gallery.innerHTML = the string.
Never done anything like this. Is there a simple method?