Hi try assuming id of two selectbox as sb1 and sb2 on onchange of sb1 call fnRemoveSelected('sb1','sb2') and for sb2 call fnRemoveSelected('sb2','sb1') call function fnRemoveSelected(search,remove){ var objSearch=document.getElementById(search); var objRemove =document.getElementById(remove); var arrSearched=new Array(); for(i=0;i<objSearch.options.length;i++){ if(objSearch.options[i].selected){ //select text or value here as per your requirement arrSearched.push(objSearch.options[i].text); } } for(i=objRemove .options.length-1;i>=0;i--) //normally we can use indexOf to search in array but I think it won't work in IE for (j=0;j<arrSearched.length;j++){ if(objRemove.options[i].text==arrSearched[j]){ objRemove.remove(i); } } } } Modify your search depending on text or value check if this help.. On Sun, Oct 5, 2008 at 4:28 PM, Sana Alamgeer <sanalmgr47@xxxxxxxxx> wrote: > thanks for helping me but this code is actually useless to me. the situation > is... there r two list boxes on my site having same items in both. i want > user to not to select the same items from the two list boxes. if somehow > user do so there must be an alert box to indicate the user or the selected > item in one list box should be automatically removed in the socond list > box. i dn't know which function should i call in javascriptn how to cmpare > these items. > pleeeeeeese help me i need it hardly. > regards > > SanaAlamgeer > > --- On Sun, 10/5/08, Aminul Islam <aminulsumon@xxxxxxxxx> wrote: > > From: Aminul Islam <aminulsumon@xxxxxxxxx> > Subject: Re: problem > To: php-objects@xxxxxxxxxxxxxxx > Date: Sunday, October 5, 2008, 4:44 AM > > hope this example will help you > $A=array('first' ,'second' ,'third', 'forth'); > $B=array('another' ,'fifth', 'second', 'first',' hello'); > for($i=0;$i< count($A) ;$i++) > if(in_array( $B[$i],$A) ) > echo "Item found: ".$B[$i]; > > i am searching one by one item of $B array in array $A > > Thanks > Aminul > > On Sat, Oct 4, 2008 at 3:37 AM, Sana Alamgeer <sanalmgr47@yahoo. com> wrote: > >> hello all, >> please tell me how to cmpare two lists' items. >> pleassssssssse >> i have been able to find the code in javascript. >> please help me >> regards >> >> SanaAlamgeer >> >> [Non-text portions of this message have been removed] >> >> >> > > -- > Md. Aminul Islam > http://www.shopno- dinga.com > Mob: 8801671670797 > > [Non-text portions of this message have been removed] > > [Non-text portions of this message have been removed] > >