Forum Moderators: open
function ChangeTypIm(){
if (form2.typImCh.checked==true) {
document.getElementById("form2_id1").style.visibility = "visible";
document.getElementById("form2_id2").style.visibility = "visible";
document.getElementById("form2_id3").style.visibility = "visible";
document.getElementById("form2_id4").style.visibility = "visible";
document.getElementById("form2_id5").style.visibility = "visible";
document.getElementById("form2_id6").style.visibility = "visible";
} else {
document.getElementById("form2_id1").style.visibility = "hidden";
document.getElementById("form2_id2").style.visibility = "hidden";
document.getElementById("form2_id3").style.visibility = "hidden";
document.getElementById("form2_id4").style.visibility = "hidden";
document.getElementById("form2_id5").style.visibility = "hidden";
document.getElementById("form2_id6").style.visibility = "hidden";
}
}
How can I replace document.getElementById.... with FOR cycle?
Thanks
for (var i = 0; i < 10; i++) {
// code here
}
This way, the variable i will not be available outside the scope of the function. Nor will it interfere with a variable i that may exist outside the function.
(int is not a javascript statement)