Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in pull down menu

Status
Not open for further replies.

janwills

Programmer
Apr 3, 2002
8
0
0
US
How do I put an image in an html pull down menu? I tried putting the link to the image in the select statment but it doesn't work.

<select name=statusvalue>
<option>Choose statusvalue
<option><img src=&quot;../legends/Red.gif&quot; >
<option>critical
</select>
 
What you could do is to have a list of the images that you want in the drop down, with the value attribute as the actual name of the file. then using an onChange method, call some javascript that will display the image on the page.

I haven't tested this but it is something along the lines of:

<script language=&quot;javascript&quot;>
function showImage(ImageShow) {
document.something.selectPic.src = 'Images/' + ImageShow;
}
</script>

<form name=&quot;something&quot;>

<select name=statusvalue onChange=&quot;showImage(this.value)&quot;>
<option value=&quot;##&quot;>Choose statusvalue</option>
<option value=&quot;red.gif&quot;>Red</option>
<option value=&quot;critical.gif&quot;>critical</option>
</select>

<img src=&quot;blank_image.gif&quot; name=&quot;selectPic&quot;>

</form>

hope this helps!

Tony
 
Script works well Tony!

You will probably find scripts on Dynamicdrive.com which will do what you want. But it won't be a normal drop down list, rather some divs and fancy DHTML. :)


É
::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top