Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4028258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:11:54+00:00 2026-05-20T11:11:54+00:00

I have a problem with Javascript. I’m trying to set a background image for

  • 0

I have a problem with Javascript. I’m trying to set a background image for an option in a multi select box. This works with Firefox 3.6.14, but not with Internet Explorer 8. I have made a short code sample to show you the problem. Does anyone have a solution for my problem?

<html>
<head>
<script language="javascript" type="text/javascript">
    function changeIssueTypes(){
        var testSelect = document.getElementById("testSelect");
        var comboBoxTest = document.getElementById("comboBoxTest");

        testSelect.options.length = 0;
        if(comboBoxTest.value == 'optionTest1')
        {
            testSelect.options[0] = new Option();
            testSelect.options[0].value = 'testOption1';
            testSelect.options[0].innerHTML = 'Test option 1';
            testSelect.options[0].style.backgroundImage = 'url(http://www.multimove.nl/images/icons/small/icon_document.gif)';
            testSelect.options[0].style.backgroundRepeat = 'no-repeat';
        }
        if(comboBoxTest.value == 'optionTest2')
        {
            testSelect.options[0] = new Option();
            testSelect.options[0].value = 'testOption1';
            testSelect.options[0].innerHTML = 'Test option 1';
            testSelect.options[0].style.backgroundImage = 'url(http://www.middelburg.nl/static/middelburgpresentation/images/icons/icon_pdf.gif)';
            testSelect.options[0].style.backgroundRepeat = 'no-repeat';
        }
    }
</script>
</head>
<body>
<form>
    <select id="comboBoxTest" onchange="changeIssueTypes()">
        <option value="optionTest1" >Option test 1</option>
        <option value="optionTest2" >Option test 2</option>
    </select>
    <br/>
    <select multiple id="testSelect">
        <option value="initialOption">Test initial option</option>
    </select>
</form>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:11:55+00:00Added an answer on May 20, 2026 at 11:11 am

    First of all: Try to set appropriate CSS properties “by hand”, directly in CSS; I’m afraid IE8 doesn’t allow change the background-image property on multi-line selectbox.

    If so, try to use standard DOM methods like appendChild() and createElement() to proper create DOM element:

        var opt = document.createElement("option");
        opt.value = "value";
        opt.innerHTML = "blah blah";
        opt.style.backgroundImage = "...";
    
        testSelect.appendChild(opt);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Javascript problem I cannot solve. My code is: <script type=text/javascript> var
I have experienced a weird problem with javascript. The problem page uses some jQuery
i have an unusual javascript problem, i have a javascript problem that alternately refuses
I have problem with SharePoint encoding the javascript link, that normally renders like href=javascript:Function('url');
I have problem need to solved with Regex If i am using Firefox or
I have problem when try to shift bit for a negative number with Perl.
Using Crockford's method ( http://javascript.crockford.com/prototypal.html ) doesn't work when we have reference values in
I am trying to use JSON for getting dynamic content to my webpage, using
I am new to Jquery and and trying to build a simple gallery. I
I need some help with jQuery uploadify . When uploading, I want to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.