PDA

View Full Version : Dynamic Image Selector without the selection box?



aharvey
07-27-2005, 08:59 PM
Script: Dynamic Image Selector

http://www.dynamicdrive.com/dynamicindex4/imageselector.htm

I've been using this script for a while, and while it has been very useful I would rather simply embed the choices as links in text (think tooltips) than use the selection box approach. However, with tooltips it doesn't seem possible for a tooltip-activated image to persist once you've clicked on another link.

jscheuer1
07-28-2005, 06:22 AM
However, with tooltips it doesn't seem possible for a tooltip-activated image to persist once you've clicked on another link.What's the difference? With Dynamic image selector, once you click on another selection, the previous image doesn't persist either.

aharvey
07-28-2005, 07:47 PM
What's the difference? With Dynamic image selector, once you click on another selection, the previous image doesn't persist either.
There's a big difference, at least I think there is! With the Dynamic image selector, there can be lots of other links on the page, and clicking or "mouseovering"(?) them does not affect the selected image. With the tooltip, the image disappears when the next link is activated.

I'd like to be able to call up one image, say of an entire plant, on a page that describes the plant. The description may have some technical terms with which I (the user) may not be familiar, so I'd like to be have these also be links to illustrated definitions of terms that I can look at while also looking at my original image. Again, I make this work with one set of selections and one set of tooltips, but inline links would be cleaner in this case than the selection box.

jscheuer1
07-28-2005, 09:24 PM
OK, I misunderstood. Of course you can use a link to do what a select box option does, the syntax is just a little different:

<a href="http://images.amazon.com/images/P/1565924940.01.TZZZZZZZ.jpg" onclick="generateimage(this.href, 0);return false;">DHTML Guide</a>The 0 in (this.href, 0) is the number for the description. Also you need to alter the script slightly, where it says:

function generateimage(which){Make it say:

function generateimage(which, num){and where it has:

contentobj.innerHTML='<center><img src="'+which+'"><br><br>'+description[tempobj.options.selectedIndex]+'</center>'Make it like this:

contentobj.innerHTML='<center><img src="'+which+'"><br><br>'+description[num]+'</center>'

aharvey
07-29-2005, 08:18 PM
John,

Thank you! That works like a charm. Now I can have the best of both worlds (i.e, "static" images and dynamic tooltips) on the same page.