...

View Full Version : dropdown linked to image thumbs



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

A dynamically generated dropdown box that will display something like

A
B
C

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.

Spudhead
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.

Archangel
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.

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

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



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

<form>
<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>
</select>
</form>

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum