View Full Version : dropdown linked to image thumbs

02-18-2007, 08:44 AM
How would this work:

A dynamically generated dropdown box that will display something like


Next to it I need to display image thumbnail.
I would think the easiest way would be to name jpegs A.jpg B.jpg C.jpg
When A is selected, it would go and pick up a corresponding image and display it.
Ajax and JavaScript come to mind, is there a way to entertwine it all into ASP?

Entire solution would be really nice, if you've got time for this.
Thank you.

02-19-2007, 10:33 AM
How about this:

you name your images as you said
you keep them all in a specified folder

you populate your dropdown by getting a list of files in that folder
you get your asp to write the drowndown options HTML, and also a javascript image preload array

when the dropdown box changes, you use client-side javascript to change the image, and don't have to make trips to the server every time.

02-19-2007, 03:38 PM
Straight ASP, no...

Like Spudhead said, you'll need the javascript to display your image if you don't want to submit the page.

02-19-2007, 06:25 PM
hum, yeah. except I don't know javascript.
Was hoping for a snippet.

02-19-2007, 06:38 PM
u got lucky, i had a script that i made a while back laying around.

function DisplayImage(myForm){
var strImageName = myForm.SelectImage;
document.getElementById("DisplayThumb").innerHTML = "<img src='images/" + strImageName.value + "' />"

<select name='SelectImage' id='SelectImage' onchange='DisplayImage(this.form)'>
<option value='checkmark.jpg'>1</option>
<option value='help2.gif'>2</option>
<option value='help_test.gif'>3</option>
<option value='icon_email.gif'>4</option>
<option value='login_button.gif'>5</option>

<div name='DisplayThumb' id='DisplayThumb'></div>