changing background color of multiple select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bosconian

    changing background color of multiple select

    I have two multiple select inputs. Initially the first contains a bunch of
    items and the second is empty. Using a common method, I move items back and
    forth by double clicking on them.

    This portion works perfectly, but I would also like to change the background
    color of the select element with the current focus.

    I have defined the following classes:

    ..selected {
    background: #C0FFFF
    }
    ..deselected {
    background: #FFFFFF
    }
    Using the following function below I am able to shift the background color
    of rows containing content, but the color of the empty rows remain the
    "selected" color. How can this effect be achieved for all rows, whether they
    contain content or not?

    Thanks!

    -----------------------------------------------------------

    function changeBackgroun d(obj,theSelect ) {
    for (var i=1; i<obj.length; i++) {
    obj[i].className = 'deselected';
    }
    obj[theSelect].className = 'selected';
    }


  • Erwin Moller

    #2
    Re: changing background color of multiple select

    Bosconian wrote:
    [color=blue]
    > I have two multiple select inputs. Initially the first contains a bunch of
    > items and the second is empty. Using a common method, I move items back
    > and forth by double clicking on them.
    >
    > This portion works perfectly, but I would also like to change the
    > background color of the select element with the current focus.
    >
    > I have defined the following classes:
    >
    > .selected {
    > background: #C0FFFF
    > }
    > .deselected {
    > background: #FFFFFF
    > }
    > Using the following function below I am able to shift the background color
    > of rows containing content, but the color of the empty rows remain the
    > "selected" color. How can this effect be achieved for all rows, whether
    > they contain content or not?
    >
    > Thanks!
    >
    > -----------------------------------------------------------
    >
    > function changeBackgroun d(obj,theSelect ) {
    > for (var i=1; i<obj.length; i++) {
    > obj[i].className = 'deselected';
    > }
    > obj[theSelect].className = 'selected';
    > }[/color]

    Hi Bosconian,

    I think you misposted. :-)
    This is comp.lang.php
    I think you want a HTML or JS newsgroup.

    Regards,
    Erwin Moller

    Comment

    • Bosconian

      #3
      Re: changing background color of multiple select

      "Bosconian" <bosconian@plan etx.com> wrote in message
      news:guWdnT2ZON 8g98XZRVn-pQ@comcast.com. ..[color=blue]
      > I have two multiple select inputs. Initially the first contains a bunch of
      > items and the second is empty. Using a common method, I move items back[/color]
      and[color=blue]
      > forth by double clicking on them.
      >
      > This portion works perfectly, but I would also like to change the[/color]
      background[color=blue]
      > color of the select element with the current focus.
      >
      > I have defined the following classes:
      >
      > .selected {
      > background: #C0FFFF
      > }
      > .deselected {
      > background: #FFFFFF
      > }
      > Using the following function below I am able to shift the background color
      > of rows containing content, but the color of the empty rows remain the
      > "selected" color. How can this effect be achieved for all rows, whether[/color]
      they[color=blue]
      > contain content or not?
      >
      > Thanks!
      >
      > -----------------------------------------------------------
      >
      > function changeBackgroun d(obj,theSelect ) {
      > for (var i=1; i<obj.length; i++) {
      > obj[i].className = 'deselected';
      > }
      > obj[theSelect].className = 'selected';
      > }
      >
      >[/color]

      Disregard--wrong group. Doh!


      Comment

      Working...