JS¼¼Êõ

javascript¶ÔListBoxµÄÔö ɾ

×ÖºÅ+ ×÷Õߣº À´Ô´£º    2014-11-17 20:00 ÎÒÒªÆÀÂÛ( )

javascript¶ÔListBoxµÄÔö ɾ,ÔĶÁjavascript¶ÔListBoxµÄÔö ɾ,javascript ¶ÔListBoxµÄÔö ɾ ¼ÙÉèÓÐ2¸öListBox£¬ID·Ö±ðΪlbLeft£¬lbRightÑ¡ÖÐlbLeftÀïµÄÏîÌí¼Óµ½lbRightÀï:function add() { var left; v...

javascript ¶ÔListBoxµÄÔö ɾ

¼ÙÉèÓÐ2¸öListBox£¬ID·Ö±ðΪlbLeft£¬lbRight

Ñ¡ÖÐlbLeftÀïµÄÏîÌí¼Óµ½lbRightÀï:

 function add()

    {

        var left;

        var right;

        left = document.getElementById("lbLeft");

        right = document.getElementById("lbRight");

        for(var i=0;i<left.length;i++)

        {

            if(left.options[i].selected)

            {

                //ÅжϸÃÏîÊÇ·ñÒѾ­´æÔÚ

                for(j=0;j<right.length;j++)

                {

                    if(right.options[j].value==left.options[i].value)

                    {

                        return;

                    }

                }

                right.add(new Option(left.options[i].text,left.options[i].value));

            }

        }

    }

 

ɾ³ýlbRightÀïµÄÏ

 

    function del()

    {

        right=document.getElementById("lbRight");

        for(i=right.length-1;i>=0;i--)

        {

            if(right.options[i].selected)

            {

                right.remove(i);

            }

        }

        //ÖØи³Öµ

        for(j=0;j<right.length;j++)

        {

            document.getElementById("txtAllName").value+=right.options[j].text+",";

            document.getElementById("txtAllID").value+=right.options[j].value+",";

        }

    }

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ѧϰJavaScriptÖ®this,call,apply

    ѧϰJavaScript֮this,call,apply

    2016-01-28 20:45

  • Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ - CSDN.NET qq_3

    Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ

    2015-12-15 09:04

  • ¡¾JavaScript.2¡¿±æÎöTypeof²Ù×÷·û×÷Óã¬ÂÞÁÐJSÎå´óÊý¾ÝÀàÐÍÕóÈÝ - Ã϶«»Ô ÀÈ·»Ê¦·¶Ñ§ÔºÐÅÏ¢¼¼ÊõÌá¸ß°à

    ¡¾JavaScript.2¡¿±æÎöTypeof²Ù×÷·û×÷Óã¬ÂÞÁÐJSÎå´óÊý¾ÝÀàÐÍÕóÈÝ -

    2015-12-15 09:00

  • ͼÏñ´¦ÀíÖеÄÊýѧԭÀíÏê½â19¡ª¡ªº¯ÊýµÄ¼«ÏÞ - °×Âí¸º½ðÄרÀ¸ - ²©¿ÍƵµÀ - CSDN.NET °×Âí¸º½ðÄרÀ¸

    ͼÏñ´¦ÀíÖеÄÊýѧԭÀíÏê½â19¡ª¡ªº¯ÊýµÄ¼«ÏÞ - °×Âí¸º½ðÄרÀ¸ - ²©

    2015-12-14 19:00

ÍøÓѵãÆÀ
ò