Views 8060 Votes 0 Comment 0
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
137 Develop [c] 프로그래밍 과제..(colprint) file hooni 2003.04.23 6745
136 Develop [php] 초간단 웹 카운터.. file hooni 2003.04.23 7063
135 Develop [jsp][php] LDAP 프로그래밍.. file hooni 2003.04.23 7386
134 Develop [c] C에서 MySQL DB 사용하기~ file hooni 2003.04.23 7011
133 Develop [php] 초간단 게시판 페이지 분할 알고리즘 hooni 2003.04.23 8699
132 Develop [vbs] CD롬 뱉는 스크립트.. hooni 2003.04.23 11699
131 Develop [js] 새로고침(refresh)방법과 다른 페이지 바꾸기.. hooni 2003.04.23 6521
130 Develop [c] 단기과정[01/24] 정렬 알고리즘 hooni 2003.04.23 6955
129 Develop [c] 단기과정[01/17] 후위연산 스택 계산기.. file hooni 2003.04.23 7226
128 Develop [c] 단기과정[01/15] 피보나치, 파스칼.. 링크리스트 file hooni 2003.04.23 7234
127 Develop [c] 단기과정[01/14] 피보나치, 파스칼.. 파일입출력 file hooni 2003.04.23 7081
126 Develop [c] 단기과정[01/14] 파일 입출력 file hooni 2003.04.23 6821
125 Develop [c] 단기과정[01/10] 과제.. swap(any data, ..) file hooni 2003.04.23 6904
124 Develop [c] 단기과정[01/08] 과제.. 파스칼 삼각형 file hooni 2003.04.23 7256
123 Develop [c] 단기과정[01/08] (다차원 + 배열)포인터, void 포인터 hooni 2003.04.23 7770
122 Develop [c] 단기과정[01/08] 배열, 포인터 hooni 2003.04.23 7223
Board Pagination Prev 1 ... 43 44 45 46 47 ... 53 Next
/ 53