2012-8-1複選框全選

//點擊父複選框時
   function clickParentBox(obj){
    var childbox = document.all("子ID");
    if(obj.checked)
     for(i = 0 ; i< childbox.length ; i++)
      childbox[i].checked = true;
    else
     for(i = 0 ; i< childbox.length ; i++)
      childbox[i].checked = false;
   }
  //點擊子複選 框時
   function clickChildBox(){
    var parentbox = document.getElementById("父ID");
    var childbox = document.all("childBox");
    for(i = 0 ;i < childbox.length ; i++){
     if (!childbox[i].checked)
      parentbox.checked = false;
    }
   }ide

相關文章
相關標籤/搜索