收到特定值后,我想禁用文本框。最后2个文本框未被禁用

时间:2017-07-03 07:46:34

标签: javascript

function setRCA() { 
 var env = document.getElementById("environment"); 
 var selectedOption = env.options\[env.selectedIndex\]; 
 var envvalue = selectedOption.getAttribute("env"); 
 var textBox = document.getElementById("rcarequired"); 
 if(envvalue=="3") { textBox.value = "Yes"; 
  document.getElementById("rcaheattask").disabled = false; 
  document.getElementById("rcaTaskPriority").disabled = false; 
  document.getElementById("rcaIncident").disabled = false; 
  document.getElementById("rcaTaskStartDate").disabled = false; 
  document.getElementById("rcaHour").disabled = false; 
  document.getElementById("rcaMinute").disabled = false; 
  document.getElementById("rcaPeriod").disabled = false; 
  document.getElementById("rcaEndDate").disabled = false; 
  document.getElementById("rcaDuration").disabled = false; 
  document.getElementById("rcaeffort").disabled = false; 
  document.getElementById("rcaTiming").disabled = false; 
  document.getElementById('rcarootcause').disabled = false; } 
 else { 
  textBox.value = "No"; 
  document.getElementById("rcaheattask").disabled = true; 
  document.getElementById("rcaTaskPriority").disabled = true; 
  document.getElementById("rcaIncident").disabled = true; 
  document.getElementById("rcaTaskStartDate").disabled = true; 
  document.getElementById("rcaHour").disabled = true; 
  document.getElementById("rcaMinute").disabled = true; 
  document.getElementById("rcaPeriod").disabled = true; 
  document.getElementById("rcaEndDate").disabled = true; 
  document.getElementById("rcaTiming").disabled = true; 
  document.getElementById("rcaDuration").disabled = true;
  // These two do not get disabled 
  document.getElementById("rcaeffort").disabled = true; 
  document.getElementById('rcarootcause').disabled = true;
 } } 

Screenshot

0 个答案:

没有答案