/    Sign up×
Community /Pin to ProfileBookmark

adding background image to options in select box

hi guys,
im using a javascript to add options to the select box as below:

function addOption(selectbox, value, text )
{
var optn = document.createElement(“OPTION”);
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

i wanted to add a background image to the options in the select box.
im need of the css style code for select box and its options

Please help me.

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@FangJan 10.2009 — You can't add images to options.
Copy linkTweet thisAlerts:
@aj_nscJan 10.2009 — I don't mean to hijack this thread, and i don't think I am considering this is quite relevant to the OP but, perhaps somebody could tell me, or provide some insight on how images are used in place of options here:

http://www.ajaxload.info/
Copy linkTweet thisAlerts:
@FangJan 10.2009 — A script adds a div with links containing images.

There are options (without images) when JavaScript is disabled.

Generated code with JavaScript enabled:
<div style="display: block;" id="typelist"><a href="javascript:ALuseType(1)" title="Circle ball"><img src="images/exemples/1.gif" alt="Circle ball"></a><a href="javascript:ALuseType(2)" title="Indicator"><img src="images/exemples/2.gif" alt="Indicator"></a><a href="javascript:ALuseType(3)" title="Kit"><img src="images/exemples/3.gif" alt="Kit"></a></div>
<select id="type" name="type">
<option value="1">Circle ball</option>
<option value="2">Indicator</option>
<option value="3">Kit</option>

Copy linkTweet thisAlerts:
@Major_PayneJan 11.2009 — Asked and answered at this forum. ?
×

Success!

Help @accetdinesh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...