Re: problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This code may help you

  <script language=javascript>
  var box1id = 'box1';
  var box2id = 'box2';
  var box1index = 0;
  var box2index = 1;

    function checkdup() {
        box1obj = document.getElementById(box1id);
        box2obj = document.getElementById(box2id);
        if (box1obj && box2obj) {
            content1 = box1obj.options[box1obj.selectedIndex].value;
            content2 = box2obj.options[box2obj.selectedIndex].value;
            if (content1 == content2) {
                alert('box1 and box2 have same value (' + content1 + ')');
                box1obj.selectedIndex = box1index;
                box2obj.selectedIndex = box2index;
                return false;
            }
            else {
                box1index = box1obj.selectedIndex;
                box2index = box2obj.selectedIndex;
            }
        }
        else {
            alert('No box');
        }
        return true;
    }

  </script>
  Box1 = <select name='box1' id='box1' onchange='checkdup();'>
  <option value=value1 selected>Name1</option>
  <option value=value2>Name2</option>
  <option value=value2>Name3</option>
  </select><br>

  Box2 = <select name='box2' id='box2' onchange='checkdup();'>
  <option value=value1>Name1</option>
  <option value=value2 selected>Name2</option>
  <option value=value2>Name3</option>
  </select><br>



On Sun, Oct 5, 2008 at 5:58 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<aminulsumon%40gmail.com>>
> wrote:
>
> From: Aminul Islam <aminulsumon@xxxxxxxxx <aminulsumon%40gmail.com>>
> Subject: Re:  problem
> To: php-objects@xxxxxxxxxxxxxxx <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]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux