메뉴 건너뛰기

조회 수 5668 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
<html>
<head>
 <SCRIPT LANGUAGE="JavaScript">
  function moveOver() {
 var boxLength = document.choiceForm.choiceBox.length;
 var selectedItem = document.choiceForm.available.selectedIndex;
 var selectedText = document.choiceForm.available.options[selectedItem].text;
 var selectedValue = document.choiceForm.available.options[selectedItem].value;
 var i;
 var isNew = true;
  if (boxLength != 0) {
   for (i = 0; i < boxLength; i++) {
    thisitem = document.choiceForm.choiceBox.options[i].text;
     if (thisitem == selectedText) {
      isNew = false;
      break;
     }
    }
  } 
  if (isNew) {
   newoption = new Option(selectedText, selectedValue, false, false); 
   document.choiceForm.choiceBox.options[boxLength] = newoption;
  }
  document.choiceForm.available.selectedIndex=-1;
 }
  function removeMe() {
 var boxLength = document.choiceForm.choiceBox.length;
  arrSelected = new Array();
 var count = 0;
  for (i = 0; i < boxLength; i++) {
   if (document.choiceForm.choiceBox.options[i].selected) {
    arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
   }
   count++;
  }
 var x;
  for (i = 0; i < boxLength; i++) {
   for (x = 0; x < arrSelected.length; x++) {
    if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
     document.choiceForm.choiceBox.options[i] = null;
       }
   }
   boxLength = document.choiceForm.choiceBox.length;
     }
 }
 </script>
</HEAD>
<BODY>
 <center>
<form name="choiceForm">
<table border=0>
<tr>
<td valign="top" width=175>
 <br>
<select name="available" style="width:150" size=10 onchange="moveOver();">
<option value=1>1 
<option value=2>2
<option value=3>3 
<option value=4>4
<option value=5>5
</select>
</td>
<td valign="top">
 <br>
<select multiple name="choiceBox" style="width:150;" size="10">
</select>
</td>
</tr>
<tr>
<td colspan=2 height=10>
                                                 <input type="button" value="제거" onclick="removeMe();">
</td>
</tr>
</table>
</form>
</center> 

  1. No Image 27Feb
    by
    2014/02/27 Views 5702 

    JavaScript 날짜관련함수

  2. No Image 23Dec
    by
    2016/12/23 Views 5701 

    우클릭 금지

  3. No Image 01Mar
    by 조쉬
    2014/03/01 Views 5668 

    선택된 select 의 option 값을 다른 select로 넘겨주기

  4. No Image 21Sep
    by
    2016/09/21 Views 5657 

    javascript 에서 제공하는 3가지 종류의 팝업박스

  5. No Image 21Sep
    by
    2016/09/21 Views 5652 

    arguments object

  6. No Image 01Mar
    by
    2014/03/01 Views 5651 

    Textarea 글자수 체크

  7. 주민번호 입력시 생일 자동입력

  8. No Image 06Apr
    by
    2015/04/06 Views 5596 

    자바스크립트 이벤트 목록입니다. ( javascript event )

  9. No Image 01Mar
    by
    2014/03/01 Views 5593 

    div 높이 가운데정렬

  10. No Image 28Apr
    by
    2015/04/28 Views 5580 

    CheckBox 전체 선택 & 해제

  11. No Image 11Sep
    by
    2016/09/11 Views 5562 

    input radio 체크유무 검사

  12. '레이블', 반복문을 제어하자!

  13. No Image 11Sep
    by
    2016/09/11 Views 5518 

    jquery 기본 엘리먼트 속성제어방법

  14. No Image 17Mar
    by
    2014/03/17 Views 5518 

    이미지클릭시 옆에 큰이미지나오기

  15. No Image 01Mar
    by
    2014/03/01 Views 5513 

    샘플) top left menu

  16. No Image 01Mar
    by
    2014/03/01 Views 5469 

    input type checkbox 체크했는지 검사하는 소스

  17. No Image 01Mar
    by
    2014/03/01 Views 5455 

    지정한 크기로 링크페이지 새창열기

  18. No Image 27Feb
    by
    2014/02/27 Views 5455 

    input 박스에서 유용한 자바 스크립트

  19. No Image 01Mar
    by
    2014/03/01 Views 5451 

    라디오 버튼 체크

  20. No Image 27Feb
    by
    2014/02/27 Views 5441 

    적용이 간편한 [글목록 인쇄] 등 특정 영역 인쇄하기 팁

Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved