i created an if-Loop, but i want to check many variables. The variable belong to a different id, as you can see below. Is it possible to optimize the code, because i don't want to copy-past and change the variables.
if (T11 > 33){
document.getElementById("T11").innerHTML = '-';
}
else if(T11 > 2){
document.getElementById("T11").innerHTML = T11-30;
document.getElementById("T11").style.textDecoration = 'underline';
}
else {
document.getElementById("T11").innerHTML = T11;
}
if (T12 > 33){
document.getElementById("T12").innerHTML = '-';
}
else if(T12 > 2){
document.getElementById("T12").innerHTML = T12-30;
document.getElementById("T12").style.textDecoration = 'underline';
}
else {
document.getElementById("T12").innerHTML = T12;
}
if (T.. > 33){
document.getElementById("T..").innerHTML = '-';
}
else if(T.. > 2){
document.getElementById("T..").innerHTML = T..-30;
document.getElementById("T..").style.textDecoration = 'underline';
}
else {
document.getElementById("T..").innerHTML = T..;
}
Please suggest.
Aucun commentaire:
Enregistrer un commentaire