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
457 Develop [c] 간단한 순위 루틴.. (질문에 대한 답변) hooni 2003.04.23 7494
456 Develop [php] 데이터를 엑셀,워드 형태로 변환할 때 헤더(ms-office) hooni 2013.04.23 7516
455 Develop [chm] 비주얼 C++ 팁 모음 문서 file hooni 2013.04.23 7519
454 Develop [c] 시어핀스키 가스킷..(p.582, A.2 - 두번째) hooni 2003.04.23 7529
453 Develop [chm] 윈도우즈에서 디버깅 기법(Debugging Applications) file hooni 2013.04.23 7549
452 Develop [php] 웹 응용프로그램(engines) 모음 file hooni 2013.04.23 7565
451 Develop [c] IP 스푸핑(ip spoof) 소스 - 정리해야 함 file hooni 2003.04.23 7575
450 Develop [c] 정수를 2진수로 변환 (재귀,비트연산) file hooni 2003.04.23 7605
449 Develop [c] 소켓 스트림 서버/클라이언트 (UDP) file hooni 2013.04.23 7610
448 Develop [c++] 초간단 스택 두 가지 방식(class, struct) file hooni 2013.04.23 7628
447 Develop [c++] 윈도우 API 정복 예제 file hooni 2013.04.23 7633
446 Develop [js] 비만 지수 측정(BMI) ㅎㅎ file hooni 2013.04.23 7635
Board Pagination Prev 1 ... 28 29 30 31 32 33 34 35 36 37 ... 71 Next
/ 71