ddddddddd

function disableAll() {
 var inputs = document.getElementsByTagName('INPUT');
 for (i in inputs) {
  if (inputs[i].type == 'TEXT' || inputs[i].type == 'TEXTAREA') {
   inputs[i].readonly = true;
  } else {
   inputs[i].disabled = true;
  }
 }
 var selects = document.getElementsByTagName('SELECT');
 for (i in selects) {
  selects[i].disabled = true;
 }
}

function hideControl(id) {
 document.getElementById(id).style.display='none';
}

function showControl(id) {
 document.getElementById(id).style.display='';
}

function disableControl(id) {
 document.getElementById(id).disabled=true;
}

function enableControl(id) {
 document.getElementById(id).disabled=false;
}

function clearControl(id) {
 var control = document.getElementById(id);
 try {
  var controlType = control.tagName.toUpperCase();
  if (controlType == 'SELECT') {
   control.options[0].selected = true;
  }
  if (controlType == 'INPUT') {
   var subType = control.type.toLowerCase();
   if (subType == 'text' || subType == 'hidden' || subType == 'textarea') {
    control.value = '';
   } else if (subType == 'checkbox' || subType == 'radio') {
    control.checked = false;
   }
  }
 } catch(e) {}
}

function getCheckedCount(name) {
 var count = 0;
 var checkboxes = document.getElementsByName(name);
 for (var i=0; i<checkboxes.length; i++) {
  if (checkboxes[i].checked) {
   count++;
  }
 }
 return count;
}

你可能感兴趣的:(dddfffffffffff)