• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    (排序,連選,跳選多項Option)下拉列表框1<=>下拉列表框(改進版)

    發布: 2007-6-30 18:56 | 作者: admin | 來源: | 查看: 13次 | 進入軟件測試論壇討論

    領測軟件測試網 說明: 是 上 一 回 程 式 的 改 進 版!
    本程式支持排序,Shift和Ctrl功能。矗哼B選和跳選多項Option)
    可以任意的相互操作(下拉列表框1<=>下拉列表框2)!

    如果多維數組復雜,可以自己寫一個排序函數!
    Javascript中Sort()所傳的參數為數組的倆個RECORD(我的定義),默認按
    字符排序。
    排序所傳的參數也為一個數組,例數組A 為下所示:
          a[0][0]=1;
          a[0][1]=2;    
          a[0][2]=3;
          a[0][3]=4;

          a[1][0]=1;
          a[1][1]=2;    
          a[1][2]=3;
          a[1][3]=4;

          a[2][0]=1;
          a[2][1]=2;    
          a[2][2]=3;
          a[2][3]=4;    
    每次所傳的參數為下:      
    a[0]={1,2,3,4}
    a[1]={1,2,3,4}

    。。。。。。。
    那么自己根據要求就可以對傳來的參數數組(實際為數組中的RECORD)
    中的某一個FIELD進行排序!

    select.htm
    <html>
    <head>
    <META content="text/html; charset=gb2312" http-equiv=Content-Type>
    <link rel="stylesheet" href="common.css">
    </head>
    <body bgColor=skyblue>
    <form action="select.htm" method="post" name="myform">
    <br><br><br>
    <div align="center"><center><left>    
    <table style="FONT-SIZE: smaller">
      <tr><td>
       <table>
       <tr><td>
       <select name="left_select" style="HEIGHT: 200px; WIDTH: 100px" multiple>
               <OPTION VALUE="A">A</OPTION><OPTION VALUE="B">B</OPTION>
               <OPTION VALUE="C">C</OPTION><OPTION VALUE="D">D</OPTION>
               <OPTION VALUE="E">E</OPTION><OPTION VALUE="F">F</OPTION>
               <OPTION VALUE="G">G</OPTION><OPTION VALUE="H">H</OPTION>
               <OPTION VALUE="I">I</OPTION><OPTION VALUE="J">J</OPTION>
               <OPTION VALUE="K">K</OPTION><OPTION VALUE="L">L</OPTION>
               <OPTION VALUE="M">M</OPTION><OPTION VALUE="N">N</OPTION>
               <OPTION VALUE="O">O</OPTION><OPTION VALUE="P">P</OPTION>
       </select>
       </td></tr>
       </table>
       </td><td>
       <table border="0">
       
       <br>
       <tr><td>
       <INPUT language="javascript" name="btn_select_addany" onclick="fun_select_addany(document.myform)" style="COLOR: blue; FONT-FAMILY: Webdings; FONT-SIZE: 12pt; FONT-WEIGHT: normal; HEIGHT: 28px; WIDTH: 27px" title="Add any" type=button value="8"></td></tr><tr><td>
       <INPUT language="javascript" name="btn_select_addall" onclick="fun_select_addall(document.myform)" style="COLOR: blue; FONT-FAMILY: Webdings; FONT-SIZE: 12pt; FONT-WEIGHT: normal; HEIGHT: 28px; WIDTH: 27px" title="Add all" type=button value=: DESIGNTIMESP="17713"></td></tr><tr><td>
       <br><br></td></tr><tr><td>
       <INPUT language="javascript" name="btn_select_dltany" onclick="fun_select_dltany(document.myform)" style="COLOR: blue; FONT-FAMILY: Webdings; FONT-SIZE: 12pt; FONT-WEIGHT: normal; HEIGHT: 28px; WIDTH: 27px" title ="delete any" type=button value="7"></td></tr><tr><td>
       <INPUT language="javascript" name="btn_select_dltall" onclick="fun_select_dltall(document.myform)" style="COLOR: blue; FONT-FAMILY: Webdings; FONT-SIZE: 12pt; FONT-WEIGHT: normal; HEIGHT: 28px; WIDTH: 27px" title ="delete all" type=button value="9"></td></tr>
       <tr><td></td></tr>
       <tr><td>
       </td></tr>
       </table></TD><td>   
       <table style="FONT-SIZE: smaller">
       <tr><td>
       <select name="right_select" style="HEIGHT: 200px; WIDTH: 100px" multiple>
       </select>
       </td></tr>
       </table>
       </td></TR></TBODY></TABLE></div></CENTER>
    </form>   
    </body>
    </html>
              
    <script language="javascript">
    function fun_select_addany(theform){
        var i;
        for (i=0;i<theform.left_select.length;i++){
            if (theform.left_select.options[i].selected == true){
               theform.right_select.options[theform.right_select.length]=new Option(theform.left_select.options[i].text);
               theform.left_select.options.remove(i);
               i--;
            }
        }
        sort_select(document.myform);
    }

    function fun_select_addall(theform){
        var i;   
        for (i=0;i<theform.left_select.length;i++){
            theform.right_select.options[theform.right_select.length]=new Option(theform.left_select.options[i].text);    
        }
        theform.left_select.length=0;     
        sort_select(document.myform);
    }  

    function fun_select_dltany(theform){
       var i;
       for (i=0;i<theform.right_select.length;i++){
           if (theform.right_select.options[i].selected == true){
              theform.left_select.options[theform.left_select.length]=new Option(theform.right_select.options[i].text);
              theform.right_select.options[i] =new Option("");
              theform.right_select.options.remove(i);
              i--;
           }
       }
       sort_select(document.myform);
    }

    function fun_select_dltall(theform){
        var i;   
        for (i=0;i<theform.right_select.length;i++){
            theform.left_select.options[theform.left_select.length]=new Option(theform.right_select.options[i].text);
        }
        theform.right_select.length=0;            
        sort_select(document.myform);
    }


    function sort_select(theform){
        var i;
        var left_array= new Array();
        var right_array = new Array();                    
        for (i=0;i<theform.left_select.length;i++){
            left_array[i] = new Array(theform.left_select.options[i].text);
        }
        for (i=0;i<theform.right_select.length;i++){
            right_array[i] = new Array(theform.right_select.options[i].text);
        }
    left_array.sort();
        right_array.sort();
        theform.left_select.length=0;
        theform.right_select.length=0;            
        
        for (i=0;i<left_array.length;i++){
            theform.left_select.options[theform.left_select.length]=new Option(left_array[i]);
        }
        for (i=0;i<right_array.length;i++){
            theform.right_select.options[theform.right_select.length]=new Option(right_array[i]);
        }
        left_array= new Array();
        right_array = new Array();      
    }   
    </script>

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>