View Full Version : Onclick Call External JS File

05-15-2009, 01:32 AM

I have a JavaScript image gallery that loads in a DIV. I have 4 different Galleries - each with their own image array stored in it's own External JavaScript file.

What I want to do, is when you click on a link to any of the 4 galleries that an onclick function calls the relevant external JavaScript file and then loads the array of images in the same DIV. I want to remain on the same page at all times...just a different array of images is seen by the user in the DIV.

Probably simple...but tricky for me!

Any help would be awesome..Cheers!

05-15-2009, 02:10 AM
How many images are we talking about? You might save some overhead by simply loading the image array (after the document loads) and having the image available at any time.

05-15-2009, 03:04 AM
I have about 30 images

05-15-2009, 04:14 AM
30 images total, I'd just populate a single array and load it after the page loads. If you need to separate them by sections, use a multidimensional array, one inner array per section.