> Basically I have a select box where are user can click on a name in
> the left box and move it to the right box.  This part all works. 
> What I am hoping someone can tell me is the following.  Is there
> anyway that when a person clicks on a name in the left that it is
> automatically highlighted in the right-hand side box.

I've heard that browser support for styling select options varries a lot
between browsers. So you'll want to test whatever style option(s) you
choose in the browsers you want to support. But I would think, basically,
you could do something like this: 

<script language="javascript">
  function highlightMatching(s1,s2) {
    for (var i = 0; i < s2.length; i++) {
      s2.options[i].style.bgColor = ''; 
    } 
    
    var selected = ''; 
    for (i = 0; i < s1.length; i++) {
      if (s1.options[i].selected==true) {
        selected += '|' + s1.options[i].value; 
      }
    }
    
    if (selected.length!=0) {
      selected = selected.substring(1,selected.length)); 
      selected = new RegExp('^('+selected+')$'); 
      
      for (i = 0; i < s2.length; i++) {
        if (s2.options[i].value.search(selected)>=0) {
          s2.options[i].style.bgColor = 'lightsteelblue';
        }
      }
    }
  }
</script>

<select name="s1" onchange="highlightMatching(this,this.form.s2)">
....
</select>

<select name="s2">
....
</select>

hope that's helpful. :) 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 503.236.3691

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298647
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to