<div class="codeText"> <div class="codeHead"> <span class="lantxt">XML/HTML 코드</span><span style="CURSOR: pointer" class="copyCodeText" onclick="copyIdText('code_7581')">클립보드에 콘텐츠 복사</span> </div> <div id="code_7581"> <ol class="dp-xml"> <li class="alt"><span><span class="tag"><</span><span class="tag-name">div</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"centent"</span> <span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"너비:200px; float:왼쪽; 여백-오른쪽:20px;"</span><span class="tag">></span> <span> </span></span></li> <li> <span></span><span class="tag"><</span><span class="tag-name">선택</span><span> </span><span class="attribute">다중</span><span>=</span><span class="attribute-value">"다중" </span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"select1"</span><span> </span><span class="attribute">style</span><span>=</span><span class="attribute-value">"너비:150px; 높이:160px;"</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">옵션</span><span> </span><span class="attribute">값</span><span>=</span><span class="attribute-value">"1" </span><span class="tag">></span><span>选项1</span><span class="tag"></</span><span class="tag-name">옵션</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"><</span><span class="tag-name">옵션</span><span> </span><span class="attribute">값</span><span>=</span><span class="attribute-value">"2" </span><span class="tag">></span><span>选项2</span><span class="tag"></</span><span class="tag-name">옵션</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">옵션</span><span> </span><span class="attribute">값</span><span>=</span><span class="attribute-value">"3" </span><span class="tag">></span><span>选项3</span><span class="tag"></</span><span class="tag-name">옵션</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"><</span><span class="tag-name">옵션</span><span> </span><span class="attribute">값</span><span>=</span><span class="attribute-value">"4" </span><span class="tag">></span><span>选项4</span><span class="tag"></</span><span class="tag-name">옵션</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">옵션</span><span> </span><span class="attribute">값</span><span>=</span><span class="attribute-value">"5" </span><span class="tag">></span><span>选项5</span><span class="tag"></</span><span class="tag-name">옵션</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"></</span><span class="tag-name">선택</span><span class="tag">></span><span> </span> </li> <li class="alt"><span> </span></li> <li> <span></span><span class="tag"><</span><span class="tag-name">div</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">span</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"추가" </span><span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"display:block; 너비:140px; cursor:pointer;"</span><span class="tag">></span><span>选中添加到右边</span><span class="tag">></span><span class="tag">></span><span class="tag"></</span><span class="tag-name">스팬</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"><</span><span class="tag-name">span</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"addAll" </span><span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"display:block; 너비:140px; cursor:pointer;"</span><span class="tag">></span><span>전체부添加到右边</span><span class="tag">></span><span class="tag">></span><span class="tag"></</span><span class="tag-name">스팬</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"><</span><span class="tag-name">div</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"centent" </span><span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"너비:200px; 플로트:왼쪽; 여백-오른쪽:20px;"</span><span class="tag">> </span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">선택</span><span> </span><span class="attribute">다중</span><span>=</span><span class="attribute-value">"다중" </span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"select2"</span><span> </span><span class="attribute">style</span><span>=</span><span class="attribute-value">"너비:150px; 높이:160px;"</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"></</span><span class="tag-name">선택</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">div</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"><</span><span class="tag-name">span</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"add1" </span><span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"display:block; 너비:140px; cursor:pointer;"</span><span class="tag">></span><span class="tag"><</span><span class="tag"><</span><span>选中删除到左边</span><span class="tag"></</span><span class="tag-name">스팬</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"><</span><span class="tag-name">span</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"addAll1" </span><span> </span><span class="attribute">스타일</span><span>=</span><span class="attribute-value">"display:block; 너비:170px; cursor:pointer;"</span><span class="tag">></span><span class="tag"><</span><span class="tag"><</span><span>전부选中删除到左边</span><span class="tag"></</span><span class="tag-name">스팬</span><span class="tag">></span><span> </span> </li> <li> <span></span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span> </span> </li> <li class="alt"> <span></span><span class="tag"></</span><span class="tag-name">div</span><span class="tag">></span><span> </span> </li> </ol> </div> </div> <div class="codeText"> <div class="codeHead"> <span class="lantxt">JavaScript 코드</span><span style="CURSOR: pointer" class="copyCodeText" onclick="copyIdText('code_9753')">复复内容到剪贴板</span> </div> <div id="code_9753"> <ol class="dp-c"> <li class="alt"><span><span><스크립트 유형=</span><span class="string">"text/javascript"</span><span>> </span></span></li> <li><span> </span></li> <li class="alt"> <span></span><span class="comment">//드롭다운 상자에서 다중 선택 적용 9:57 </span><span> </span> </li> <li> <span>$(</span><span class="keyword">함수</span><span>(){ </span> </li> <li class="alt"> <span></span><span class="comment">//왼쪽을 오른쪽에 추가하기 시작 </span><span> </span> </li> <li> <span>$(</span><span class="string">"#add"</span><span>).click(</span><span class="keyword">함수</span><span>(){ </span><span class="comment"> //선택한 것을 오른쪽에 추가 </span><span> </span> </li> <li class="alt"> <span>$option = $(</span><span class="string">"#select1 옵션:선택됨"</span><span>) </span> </li> <li> <span>$option.appendTo(</span><span class="string">"#select2"</span><span>) </span> </li> <li class="alt"><span>}) </span></li> <li> <span>$(</span><span class="string">"#addAll"</span><span>).click(</span><span class="keyword">함수</span><span>(){ </span><span class="comment"> //오른쪽에 모두 추가 </span><span> </span> </li> <li class="alt"> <span>$option = $(</span><span class="string">"#select1 옵션"</span><span>); </span> </li>$option.appendTo(<li> <span>"#select2"</span><span class="string">) </span><span> </span> </li>}) <li class="alt"><span> </span></li>$(<li> <span>"#select1"</span><span class="string">).dbclick(</span><span>함수</span><span class="keyword">(){ </span><span> //오른쪽에 추가하려면 더블클릭 </span><span class="comment"> </span><span> </span> </li>$option = $(<li class="alt"> <span>"#select1 옵션:선택됨"</span><span class="string">,</span><span>이것</span><span class="keyword">); 🎜> </span><span>$option.appendTo(</span> </li>"#select2"<li> <span>) </span><span class="string"> </span><span>}) </span> </li> <li class="alt"><span></span></li>//오른쪽에서 시작해 왼쪽에 추가 <li> <span> </span><span class="comment"> </span><span>$(</span> </li>"#add1"<li class="alt"> <span>).click(</span><span class="string">함수</span><span>(){ </span><span class="keyword"> //선택한 항목을 왼쪽에 추가 </span><span> </span><span class="comment"> </span><span>$option = $(</span> </li>"#select2 옵션:선택됨"<li> <span>) </span><span class="string"> </span><span>$option.appendTo(</span> </li>"#select1"<li class="alt"> <span>) </span><span class="string"> </span><span>}) </span> </li> <li><span>$(</span></li>"#addAll1"<li class="alt"> <span>).click(</span><span class="string">기능</span><span>(){ </span><span class="keyword"> //왼쪽에 모두 추가 </span><span> </span><span class="comment"> </span><span>$option = $(</span> </li>"#select2 옵션"<li> <span>); </span><span class="string">$option.appendTo(</span><span>"#select1"</span> </li>) <li class="alt"> <span> </span><span class="string">}) </span><span> </span> </li>$(<li><span>"#select2"</span></li>).dbclick(<li class="alt"> <span>함수</span><span class="string">(){ </span><span> //왼쪽에 추가하려면 더블클릭 </span><span class="keyword"> </span><span> </span><span class="comment">$option = $(</span><span>"옵션:선택"</span> </li>,<li> <span>이</span><span class="string">); </span><span>$option.appendTo(</span><span class="keyword">"#select1"</span><span>) </span> </li> <li class="alt"> <span>}) </span><span class="string"> </span><span>}) </span> </li> <li><span></script></span></li> <li class="alt"> <span> </span> </li> </ol> </div> </div>