Contents

조회 수 8084 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

좋은 예제인듯..

아래는 주요 함수 부분임~

<script> 
/* 
*Source Select의 요소(option)를 Target Select로 복사한다. 
*/ 
function copyElement(sourceObj, targetObj){
    var elms = sourceObj.options;
    for( i = 0, k = elms.length; i < k; i++ ){
        if( elms[i].selected ){
            targetObj.add(new Option(elms[i].text,
                elms[i].value, false, false));
        }
    }
    sourceObj.selectedIndex=-1; 
}

/* 
*Source Select의 요소(option)를 제거한다. 
*/ 
function removeElement(sourceObj){
    var elms = sourceObj.options;
    var posArr = new Array();
    var increase = 0;
    for( i = 0, k = elms.length; i < k; i++ ){
        if( elms[i].selected ){
            posArr[increase++] = elms[i].value;
        }
    }
    for( i = 0, k = posArr.length; i < k; i++ ){
        for( x = 0, y = elms.length; x < y; x++ ){
            if( (posArr[i] == elms[x].value) && elms[x].selected ){
                sourceObj.remove(x);
                x = 0;
                y--;
            }
        }
    } 
}

/* 
*Source Select의 요소(option)를 Target Select로 이동한다. 
*/ 
function moveElement(sourceObj, targetObj, isSort){
    var elms = sourceObj.options;
    for( i = 0, k = elms.length; i < k; i++ ){
        if( elms[i].selected ){
            targetObj.add(new Option(elms[i].text,
                elms[i].value, false, false));
        }
    }
    removeElement(sourceObj);
    sourceObj.selectedIndex = -1; 
}

/* 
*Source Select의 요소(option)의 상하순서를 바꾼다. 
*/ 
function move_option_in(src,to) {
    if(!src)return;
    var src_index = src.selectedIndex;
    if(src_index<0)return;
    if(to == "up"){
        if(src_index==-1||src_index==0)return;
        var tempoption = 
            new Option(src.options[src_index].text,
                src.options[src_index].value);
        src.options[src_index] = 
            new Option(src.options[src_index-1].text,
                src.options[src_index-1].value);
        src.options[src_index-1]=tempoption;
        src.options[src_index-1].selected=true;
    }else if(to == "down"){
        if(src_index>=src.options.length-1)return;
        var tempoption = 
            new Option(src.options[src_index].text,
                src.options[src_index].value);
        src.options[src_index] = 
            new Option(src.options[src_index+1].text,
            src.options[src_index+1].value);
        src.options[src_index+1]=tempoption;
        src.options[src_index+1].selected=true;
    } 
} 
</script> 


?

  1. [php] Laravel 5.4: Specified key was too long error

    Date2017.12.04 CategoryDevelop Byhooni Views9383
    Read More
  2. [c] 다중연결 서버 만들기 #2 - select() 사용

    Date2013.04.23 CategoryDevelop Byhooni Views9378
    Read More
  3. [c++] 더블 링크리스트(linked list) 학습용 초간단 단어장

    Date2003.04.23 CategoryDevelop Byhooni Views9367
    Read More
  4. [c++] MFC로 만든 디렉토리/파일 파인더

    Date2013.04.23 CategoryDevelop Byhooni Views9367
    Read More
  5. [java] Sieve of Eratosthenes (에라토스테네스의 체)

    Date2013.04.23 CategoryDevelop Byhooni Views9350
    Read More
  6. [js] 폼(form) 전송시 중복 클릭 방지 간단한 구문

    Date2013.04.23 CategoryDevelop Byhooni Views9329
    Read More
  7. [c] 전위 표기법으로 연산 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views9323
    Read More
  8. [c] 도메인 소켓(Unix Domain Socket) UDP

    Date2013.04.23 CategoryDevelop Byhooni Views9315
    Read More
  9. [ios] In App Purchase 개발

    Date2013.11.20 CategoryDevelop Byhooni Views9303
    Read More
  10. [c++] mfc이용한 트레이아이콘(TrayIcon) 클래스 예제 프로젝트

    Date2013.04.23 CategoryDevelop Byhooni Views9277
    Read More
  11. [c++] RSA Sample 4 CPP

    Date2013.04.23 CategoryDevelop Byhooni Views9248
    Read More
  12. [c] SetTimer() & KillTimer() & 일회용 Timer

    Date2013.04.23 CategoryDevelop Byhooni Views9243
    Read More
Board Pagination Prev 1 ... 20 21 22 23 24 25 26 27 28 29 ... 71 Next
/ 71