Ankita Singh

Ankita Singh

  • NA
  • 159
  • 19.1k

onchange event for dropdown list

Mar 5 2018 2:12 AM
var DropdownList = document.getElementById('<%=ACan.ClientID %>');
var SelectedIndex = DropdownList.SelectedIndex;---- (if debug the code thn here value is not defined)
var divtenper = document.getElementById('divtenper');
var divyear10 = document.getElementById('divyear10');
var divpertwelth = document.getElementById('divpertwelth');
var divyearof12 = document.getElementById('divyearof12');
var divgraper = document.getElementById('divgraper');
var divyearofgra = document.getElementById('divyearofgra');
//divtenper.style.display = Course.value == "1" ? "block" : "none";
if (SelectedIndex == 1) {
divpertwelth.style.display = "none";
divyearof12.style.display = "none";
divgraper.style.display = "none";
divyearofgra.style.display = "none";
divyear10.style.display = "block";
divtenper.style.display = "block";
}
else if (SelectedIndex == 2) {
divpertwelth.style.display = "block";
divyearof12.style.display = "block";
divyear10.style.display = "none";
divtenper.style.display = "none";
divgraper.style.display = "none";
divyearofgra.style.display = "none";
}
else if (SelectedIndex == 3) {
divgraper.style.display = "block";
divyearofgra.style.display = "block";
divpertwelth.style.display = "none";
divyearof12.style.display = "none";
divyear10.style.display = "none";
divtenper.style.display = "none";
}
// return true;
}
</script>
 
then not show my div

Answers (3)