메뉴 건너뛰기

조회 수 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> 

List of Articles
번호 제목 날짜 조회 수
147 자바스크립트로 네트워크 연결 확인하기 (Navigator onLine Property) file 2015.06.19 6197
146 정규식을 이용한 실시간 콤마(comma) 넣기 2015.06.19 7876
145 정규식을 이용한 콤마(comma) 제거하기 2015.06.19 6804
144 텍스트박스(input type = "text") 숫자 증가, 감소 시키기 - 쇼핑몰 주문 수량 file 2015.06.19 12281
143 Checkbox : 체크박스 체크여부 확인 file 2015.06.19 19010
142 마우스 드래그, 오른쪽 팝업메뉴, 선택 막기 (IE11, 파이어폭스, 크롬 확인) 2015.06.19 8577
141 예제 - 자바스크립트로 현재 달의 달력 만들기 (calendar) 2015.06.19 10061
140 핸드폰 번호 일부 마스킹크 작업 (정규식 이용) 2015.06.19 10741
139 창에 대한 정보얻기 (창 크기, 창 위치) file 2015.06.19 7297
138 Location 객체 - URL 파싱 - URL에서 전달인자 추출하기 함수 작성 file 2015.06.19 8523
137 예제 - 이미지를 원본 크기로 볼 수 있도록 새창으로 열기 확장 (리사이징 및 이미지 드래그) file 2015.06.19 6796
136 창 크기 최대화 시키기 file 2015.06.19 12217
135 JSON API - JSON.parse(), JSON.stringify() ( json 형태의 문자열을 JSON객체로 , JSON객체를 문자열로 ) file 2015.06.19 6289
134 자바스크립트 API 문서 2015.06.19 9086
133 공백 검사 함수 2015.06.19 14576
132 자바스크립트 아이디 기억하기 기능 구현 (쿠키저장) file 2015.06.19 10923
131 [라디오버튼 오류 체크] 간단한 문제 예제 file 2015.06.19 7712
130 iframe사용시 높이 자동 조절 2015.06.19 6958
129 이벤트 - 페이지 로드 후 이벤트 처리하기 ( window.onload ) file 2015.06.19 10871
128 jquery offset()을 이용한 부드러운 스크롤 이동 2016.09.01 7277
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved