Here is what I have so far: Very rudimentary I know, but here it is: var rand_int = Math.floor(Math.random()*4); var photos = new Array(4) photos[0] = '<img src="images/smittys-logo.gif">'; photos[1] = '<img src="images/rickys-logo.jpg">'; photos[2] = '<img src="images/rayssecurity.jpg">'; photos[3] = '<img src="images/purdys-logo.jpg">'; document.write(photos[rand_int]); This accomplishes most of what I need, EXCEPT I would like to add above the image the actual company name. eg: Team sponsored by (then company name inserted from .js here) <br> (company logo inserted here by .js)
You can find some more code on the topic in the thread 11620. In general, you need your own objects. For example: function ImageInfo(url, title) { this.url = url; this.title = title; } Code (markup): You will use this object like this: images.push(new ImageInfo("/images/img1.jpg", "My Title")); Code (markup): Finally, you will generate images like this: img = document.getElementById("my-img-id"); img.src = images[index].url; Code (markup): You can also use document.write for this, but I would rather use DOM instead (the example above). J.D.