함수
function toggleCheckBox(obj, target){
if ( !obj ) return false;
if ( !target ) return false;
if ( target.length ) {
for ( var i = 0 ; i < target.length ; i++ ){
target[i].setAttribute("checked", obj.getAttribute("checked"));
}
}
else{
target.setAttribute("checked", obj.getAttribute("checked"));
}
}
사용예if ( !obj ) return false;
if ( !target ) return false;
if ( target.length ) {
for ( var i = 0 ; i < target.length ; i++ ){
target[i].setAttribute("checked", obj.getAttribute("checked"));
}
}
else{
target.setAttribute("checked", obj.getAttribute("checked"));
}
}
<input type="checkbox" id="" name="" value="" onclick="toggleCheckBox(this, document.getElementsByName('juminnum'));" />
<input type="checkbox" name="juminnum" value="000000-00000000">
<input type="checkbox" name="juminnum" value="000000-00000000">

글
댓글을 달아 주세요
댓글 RSS 주소 : http://haroc.haroc.net/tc/rss/comment/164