Rather than go to all that trouble, why not just AJAX to knock the duplicate items off the 2nd list when they're selected in the first? You'll still have to do checking on the submission end of things just in case, but for most people you'll never even see a duplicate selection submitted that way. -- Joe From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of pavan sharma Sent: Sunday, October 05, 2008 9:34 AM To: php-objects@xxxxxxxxxxxxxxx Subject: Re: problem 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 <mailto:sanalmgr47%40yahoo.com> > 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 <mailto:aminulsumon%40gmail.com> > wrote: > > From: Aminul Islam <aminulsumon@xxxxxxxxx <mailto:aminulsumon%40gmail.com> > > Subject: Re: problem > To: php-objects@xxxxxxxxxxxxxxx <mailto:php-objects%40yahoogroups.com> > 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] > > [Non-text portions of this message have been removed]