Contents

Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

좋은 예제인듯..

아래는 주요 함수 부분임~

<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> 


?

List of Articles
No. Category Subject Author Date Views
729 PPT [doc] 정보보호이론 강의자료 (중앙대꺼..) 2 file hooni 2013.04.23 22877
728 PPT [doc] 정보보호학술대회 논문지 ㅋㅋ file hooni 2013.04.23 12208
727 System/OS [doc] 코코아 프로그래밍 for MACOS 관련 내 분량.. file hooni 2013.04.23 20907
726 Develop [doc] 테크니컬 레포트 (BHO 취약점을 이용한 공격) 2 file hooni 2013.04.23 27135
725 System/OS [doc] 피쳐셀렉션(feature selection using..) 발표 자료 file hooni 2013.04.23 12614
724 System/OS [dos] 노트북 백업 스크립트 xcopy 명령 예제 hooni 2003.04.23 40874
723 Etc [english] 영어공부 혼자 하기, 인터넷으로 영어공부하기 추천사이트 20선 file hooni 2013.11.25 9459
722 Etc [eng] 숙제 ㅋㅋㅋ secret hooni 2015.10.14 1
721 Develop [erp] SAP 모듈 요약 hooni 2013.04.23 15326
720 Etc [flash] 맘에 드는 파이차트 file hooni 2013.04.23 12626
719 Etc [flash] 자동차 엔진의 원리 (4행정 사이클 그림) file hooni 2013.04.23 21283
718 Etc [flash] 페이지 이동 (액션스크립트) file hooni 2013.04.23 16289
Board Pagination Prev 1 ... 33 34 35 36 37 38 39 40 41 42 ... 98 Next
/ 98