There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell drive driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express printer problem problems ram router slow sound sprtcmd.exe startup trojan usb virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Dropdown Images


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Tarq's Avatar
Senior Member with 732 posts.
 
Join Date: May 2002
06-Oct-2002, 09:18 AM #1
Dropdown Images
Hi, I have a feedback form on my site. It lets users send a message to me without revealing my email address and also lets me know which are there favourites areas of the site and things like that so I can further improve it. One of the questions is "Who Is Your Favourite Character?" this is in a dropdown box format. I would like to add a feature where when a character is selected in the list an image of them appears next to it. I think I have seen this before on a logo generator site where when you clicked a font in the list a preview of that font appeared. I have all the necessary images and they are all avatar sized (about 50by50 pixels). I think Javascript could help me do this but I have looked on both Dynamic Drive and Javascript Source but couldn't find anything. Does anybody know of a script or knows a link to a page that might, I would be most grateful. Thankyou for any replies
__________________
"The Internet connects people not computers."
- Estonia Ministry of Foreign Affairs
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
08-Oct-2002, 10:15 AM #2
It can't really be done with straight html. You could do it with ASP and an onChange event for the dropdown. YOu could also do it with flash...I think this is how most web developers do it now.
Tarq's Avatar
Senior Member with 732 posts.
 
Join Date: May 2002
08-Oct-2002, 10:46 AM #3
Well i posted the exact same message in another vbulliten forum and they said it was possible. If I give you the code do you think you can change my dropdown to use that feature. Do you understand what I mean?

Here's the code I was given:

<form name="whatever">
<SELECT NAME="fav" SIZE="1"
onchange="img.src=document.whatever.fav.value">
<OPTION value="pic1.gif">Pic 1</OPTION>
<OPTION value="pic2.gif">Pic 2</OPTION>
<OPTION value="pic2.gif">Pic 2</OPTION>
<OPTION value="pic2.gif">Pic 2</OPTION>
</SELECT>
<img id="pic" name="pic">
</form>

PHP Code:
<form name="whatever">
<
SELECT NAME="fav" SIZE="1" 
onchange="img.src=document.whatever.fav.value">
<
OPTION value="pic1.gif">Pic 1</OPTION>
<
OPTION value="pic2.gif">Pic 2</OPTION>
<
OPTION value="pic2.gif">Pic 2</OPTION>
<
OPTION value="pic2.gif">Pic 2</OPTION>
</
SELECT>
<
img id="pic" name="pic">
</
form
and heres my dropdown code:

<SELECT name="Favourite_Character" size="1">
<OPTION selected> === Choose one ===
<OPTION> Pride
<OPTION> Salene
<OPTION> Siva
<OPTION> May
<OPTION> Trudy
<OPTION> Ram
<OPTION> Dee
<OPTION> Jay
<OPTION> Lex
<OPTION> Amber
<OPTION> Ved
<OPTION> Ellie
<OPTION> Dee
<OPTION> Mouse
<OPTION> Sammy
<OPTION> Java
<OPTION> Amber
<OPTION> Cloe
<OPTION> Other
</SELECT>

PHP Code:
<SELECT name="Favourite_Character" size="1">
<
OPTION selected> === Choose one ===
<
OPTIONPride
<OPTIONSalene
<OPTIONSiva
<OPTIONMay
<OPTIONTrudy
<OPTIONRam
<OPTIONDee
<OPTIONJay
<OPTIONLex
<OPTIONAmber
<OPTIONVed
<OPTIONEllie
<OPTIONDee
<OPTIONMouse
<OPTIONSammy
<OPTIONJava
<OPTIONAmber
<OPTIONCloe
<OPTIONOther
</SELECT
__________________
"The Internet connects people not computers."
- Estonia Ministry of Foreign Affairs
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
08-Oct-2002, 11:21 AM #4
Here ya go...pretty simple really


PHP Code:
<IMG SRC="images/Baseimage.gif" NAME="myImage">
<
SCRIPT LANGUAGE="JavaScript"><!--
function 
change(what) {
value what.options[what.selectedIndex].value;
    if (
value != '')
        if (
document.images)
            
document.images['myImage'].src value;
}
//--></SCRIPT>

<FORM>
<
SELECT onChange="change(this)">
<
OPTION>Select an image:
<
OPTION VALUE="images/image1.gif">Image1
<OPTION VALUE="images/image2.gif">Image2
<OPTION VALUE="images/image3.gif">Image3
</SELECT>
</
FORM
Tarq's Avatar
Senior Member with 732 posts.
 
Join Date: May 2002
08-Oct-2002, 11:44 AM #5
That didn't work and I needed you to add that code to the code I gave you so that it works, each picture will be optionvalue.jpg

for example jay.jpg
dee.jpg
ebony.jpg

Can ya do that? Thankyou very much for all your help I'm hopeless at Javascript!
__________________
"The Internet connects people not computers."
- Estonia Ministry of Foreign Affairs
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
08-Oct-2002, 12:26 PM #6
What...you want me to do it for you? Just replace the image names in the option values and that's all you have to do. Works fine with images on my test server. Make sure the path to your images is correct also....if they are in the root of your web site remove the "images" from the image path.
__________________
**Disclaimer** Anything below this line ^ is part of my signature for those that may be confused

Sadly, there are no integers on this scale, so your gangly adolescent attempt to be clever has proved futile....Dieter

I have the right "NOT" to be tolerant of others because they are different, weird, or tick me off.....Parody of Andy Rooney

There are no stupid questions, but there are a LOT of inquisitive idiots.
Tarq's Avatar
Senior Member with 732 posts.
 
Join Date: May 2002
08-Oct-2002, 12:29 PM #7
I tried again it didn't work, i'm slightly confused
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
08-Oct-2002, 12:38 PM #8
What's so confusing? Just replace the code as follows.....

PHP Code:
<OPTION VALUE="pic1.gif">Pride
<OPTION VALUE="pic2.gif">Salene
<OPTION VALUE="pic3.gif">Siva 
and so on...and so on.....EASY
Tarq's Avatar
Senior Member with 732 posts.
 
Join Date: May 2002
08-Oct-2002, 02:29 PM #9
and thats all no Javascript like you put at the top before?
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:07 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.