2005-12-29

Notes - Web: select all javascript function for checkboxes (multivalue too)

function selectAll(fieldname, bFlag) {
  var checkField = document.forms[0].elements[fieldname];
  if (checkField.length)
   {
     for (i=0; i<checkField.length; i++)
        {
           if (checkField[i].checked)
            {
               checkField[i].checked = bFlag;
           }
      }
   }
  else if (checkField.checked)
    {
       checkField.checked = bFlag;
   }
}

No comments:

Post a Comment