以下是我的javascript代码,有没有更好的方法来编写我的代码?我认为我的概念不好。下面的'$'代表'document.getElementById',为了更好地查看我正在使用'$',代码是JavaScript 不是 JQuery。
function() {
if (1) {
$("AprEmail1").style.display = "";
$("chkApp1").style.display = "";
$("AprEmail2").style.display = "";
$("chkApp2").style.display = "";
$("chkApp2").disabled = false;
$("AprEmail3").style.display = "";
$("chkApp3").style.display = "";
$("chkApp3").disabled = false;
}
else if (2) {
$("AprEmail1").style.display = "";
$("chkApp1").style.display = "";
$("AprEmail2").style.display = "";
$("chkApp2").style.display = "";
$("chkApp2").disabled = true;
$("AprEmail3").style.display = "";
$("chkApp3").style.display = "";
}
else if (3) {
$("AprEmail1").style.display = "";
$("chkApp1").style.display = "";
$("AprEmail2").style.display = "";
$("chkApp2").style.display = "";
$("chkApp2").disabled = true;
$("AprEmail3").style.display = "";
$("chkApp3").style.display = "";
$("chkApp3").disabled = true;
}
else {
$("AprEmail1").style.display = "none";
$("chkApp1").style.display = "none";
$("AprEmail2").style.display = "none";
$("chkApp2").style.display = "none";
$("AprEmail3").style.display = "none";
$("chkApp3").style.display = "none";
}
}