PDA

View Full Version : Chained Menu with icons



chrismg
02-17-2008, 04:25 PM
1) Script Title: Chained Select Menu

2) Script URL: http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm

3) Problem:

I would like to display small icons (actually a flag next to each country name) next to the text in one of the drop down menus. However I have tried using img tags and that doesn't work. Any ideas?

ddadmin
02-17-2008, 09:33 PM
If you're talking about adding an image inside each OPTION tag itself, you can't just use an IMG tag to do this. One doesn't go in the other. What you can do is use a non repeating background image, and use CSS to add that background to the option. For example:


<select>
<option style="background: url(usa.gif) left center no-repeat; padding-left: 30px">This is an option</option>
<option style="background: url(canada.gif) left center no-repeat; padding-left: 30px">This is an option as well</option>
</select>

The "30px" is to provide enough space, so the background image and OPTION text don't overlap. This is the gist anyway.

chrismg
02-21-2008, 10:03 AM
Thanks for your reply, I'll try that

Chris