<div class="codetitle"> <span><a style="CURSOR: pointer" data="57098" class="copybut" id="copybut57098" onclick="doCopy('code57098')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code57098"> <br><script language="javascript"><br><br> /* 列錶框互相操作函數集*/<br><br> //說明: 新增不重複列錶框元素<BR> function selAdd( srcList, dstList )<BR> {<BR> var selectedIndex = new Array();<BR> var count = 0;<br><br> for ( i=0; i<srcList.options.length; i ){<br><br> if ( srcList.options[i].selected ){<br><br> count ;<BR><br> }<br> } 🎜><BR> for ( j=0; j<selectedIndex.length; j ){<br><br> List.options[k]. value, dstList )==false ){<br> &, nbsp; dstList.options.length ;<br> dstList.options[len].value = srcList. options[k].value;<br> dstList.options[len].text = srcList.options[k].text;<br> > }<BR><BR> //說明: 刪除列錶框元素<BR> function selDel( list )<BR> {<BR> var len = list.options.length;< idx< len ){<br><br> if ( list.options[idx].selected ){<br> len = list.options.length;<br> } <br> else{<br> idx ;<BR> 說明: 偵測列錶框元素重複<BR> function chkDup( item, list )<BR> {<BR> for ( i=0; i<list.options.length; i ){<br> //alert( item " - " list.options[i].value );< list.options[i].value ){<br> return true;<br> <br> return false;<BR> }<BR><BR> //說明: 選取列錶框的全部成員<BR> function selSel( list, item )<BR> {<BR> item.value = " ";<BR> for ( i=0; i<list.options.p.options. [i].selected=true;<BR> item.value = list.options[i].value " ";<br> }<><br> }<list) <BR> {<BR> for ( i=0; i<list.options.length; i ){<BR> options[i ].selected=true;<BR> break;<BR> }<BR> <BR> // 說明: 根據陣列初始化列錶框<BR> function selList( item, arr )<BR> {<br><br> var curIndex, insIndex, Item, 1< );<BR><br> if ( item ){<br><br> item.length = 0;< for ( i=0; i<arr.length; i ){<br><BR> if ( arr[i] ){<br> arrItem = arr[i ].分割( ", " );<br> item.options[ insIndex ].text = text; <br> = val;<br> }<BR> }<br><br> }</script> </div>