본문 바로가기

others

자바스크립트 체크박스 관련

정리를 안했더니 계속 소스 디적거리게 되네..

언제 시간내서 자바스크립트 짜놓은거 클래스화 시켜야 되는데..

아님 JQuery로 바꾸던지 해야겠다.

//체크 카운터..

function countCheck(obj){

 

           var count = 0;

           if(obj){

                     if(obj.length){

                                for(var i = 0; i < obj.length; i++){

                                          if(obj[i].disabled == false){

                                                     if(obj[i].checked) count++;

                                          }

                                }

                     }else{

                                if(obj.disabled == false){

                                          count = obj.checked ? 1 : 0;

                                }

                     }

           }

           return count;

}

 

//체크 토글

function toggleCheck(obj){

 

           if(obj){

                     if(obj.length){

                                for(var i = 0; i < obj.length; i++) {

                                          if(obj[i].disabled == false){

                                                     obj[i].checked =! obj[i].checked;

                                    }

                         }

                     }else{

                                if(obj.disabled == false){

                                          obj.checked =! obj.checked;

                                }         

                     }

           }

}

'others' 카테고리의 다른 글

checkbyte jQuery plugin  (0) 2011.11.11
Velocity에서의 Map 사용  (0) 2009.11.24
browser의 layout engine  (0) 2009.06.17
JEUS5 webadmin 비밀번호 변경  (0) 2009.01.22
JEUS5 webadmin port찾기  (0) 2009.01.22