How to access CSS list-style-image with JS?

Discussion in 'Javascript' started by Joakim Braun, Nov 10, 2004.

  1. Joakim Braun

    Joakim Braun Guest

    Given the CSS style:

    li{list-style-image: url("someimage.gif")}

    ....how can I change the list-style-image for a given <li>, given an object
    reference?

    (I've unsuccessfully tried stuff like
    theObject.style.list-style-image="url(someotherimage.gif)")

    Joakim Braun
    Joakim Braun, Nov 10, 2004
    #1
    1. Advertising

  2. Joakim Braun wrote:


    > ...how can I change the list-style-image for a given <li>, given an object
    > reference?
    >
    > (I've unsuccessfully tried stuff like
    > theObject.style.list-style-image="url(someotherimage.gif)")


    objectReference.style.listStyleImage = "url(image.gif)";
    as with (nearly) any CSS property-name you need style.propertyName.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Nov 10, 2004
    #2
    1. Advertising

  3. Joakim Braun

    Joakim Braun Guest

    "Martin Honnen" <> skrev i meddelandet
    news:41925416$0$20930$-online.net...

    <snip>
    > objectReference.style.listStyleImage = "url(image.gif)";
    > as with (nearly) any CSS property-name you need style.propertyName.


    ....aah, thanks. Had forgotten about that hyphen thing.

    Joakim Braun
    Joakim Braun, Nov 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bulge
    Replies:
    8
    Views:
    6,048
    bulge
    Jul 19, 2004
  2. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,290
    Kartic
    Jan 26, 2005
  3. Aaron Beall
    Replies:
    2
    Views:
    1,803
    Aaron Beall
    Sep 14, 2007
  4. Ken Varn
    Replies:
    0
    Views:
    444
    Ken Varn
    Apr 26, 2004
  5. Nik Coughlin
    Replies:
    2
    Views:
    176
    Nik Coughlin
    Jan 23, 2008
Loading...

Share This Page