use javascript or other method ? have any recommendation?
views:
205answers:
2
+4
A:
IMAGE tag can not be within OPTION one (as per HTML4.01 and XHTML1.0). Apply it as a background image (of an option element) instead.
...
<option style="background-image:url(...) ...">...</option>
...
Also note that some browsers don't allow much styling on select and option elements. For example, Safari doesn't support "background-color" on option elements (there's a WebKit bug filed back in '06 :))
I've heard that Chrome has similar "issues" as well.
kangax
2009-09-20 03:22:10
but it doesn't support in IE
MemoryLeak
2009-09-20 08:43:54
+5
A:
I would recommend you to use CSS. For example:
<select style="width: 100px;">
<option style="background-image: url(/images/a.png);">First option</option>
<option style="background-image: url(/images/b.png);">Second option</option>
</select>
Viliam
2009-09-20 03:24:04