此代码在 ASP.Net 中不起作用并给出错误
Microsoft JScript 运行时错误:“选择”为空或不是对象
我的代码是
var select = document.getElementsByTagName("Dd_Select_Month_Year")[0];
select.onchange = function () {
if (select.value == "2") {
document.getElementsByTagName("txtDateFrom")[1].style.display = "inline";
document.getElementsByTagName("txtDateTo")[1].style.display = "inline";
} else {
document.getElementsByTagName("txtDateFrom")[1].style.display = "none";
document.getElementsByTagName("txtDateTO")[1].style.display = "none";
}
}