28 maj 2008

Odznaczenie elementu checbox

function off(id) {
  frm = document.forms[0];
  cnt = frm.elements.length;
  for (i = 0; i < cnt; i++) {
    if (document.forms[0].elements[i].name.indexOf('id_page_' + id) > -1)
      if (document.forms[0].elements[i].checked)
        document.forms[0].elements[i].checked = false;
      else
        document.forms[0].elements[i].checked = true;
  }
}