English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Essentially I want to display an image right next to the box corresponding to what the user selects inside of the drop down box. For example if I have a drop down box that has in it

tire.jpg
window.jpg
cup.jpg
seal.jpg

When the user selects seal.jpg for example 'onChange' kicks in and displays right next to the selection box a
. You understand what i'm saying.

2007-03-22 04:21:54 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

First, this will get your image name
imageFileName=document.formName.selectName.options[document.formName.selectName.options.selectedIndex].text

Now use to change the image.
document.images[imageName].src=imageFileName;

If you put the following at the start of your web page then the images can be all pre-loaded.
pic[0] = new Image();
pic[0].src = 'images/tire.jpg'; // preloads images

Amend this code as necessary for you page. You will have to add names to your html tags.

2007-03-22 05:09:11 · answer #1 · answered by AnalProgrammer 7 · 1 0

I enjoyed which you probably did this piece. i'm inspired to jot down as quickly as lower back. I take excitement in the cost of the rose that grew threw the concrete, reference. outstanding touch. The 0.33 stanza became the ideal for me. reliable lines and visuals. All in all a great attempt. Temari

2016-11-27 22:09:27 · answer #2 · answered by newcomer 4 · 0 0

Go to http://www.dynamicdrive.com for some very easy to use and understand scripts.
Alternatively, you could use the "onMouseOver" or "onClick" event and learn to write it yourself.

2007-03-22 04:39:54 · answer #3 · answered by ? 5 · 0 0

A quick google search and you can find tons of JavaScripts...

http://www.flowsim.se/picts/iljjava/eiljsele.html

2007-03-22 04:26:45 · answer #4 · answered by The First 3 · 0 0

fedest.com, questions and answers