So i have a html table with 5 variables va1,va2,va3,va4,va5. I want to use them in javascript so that when i click a button it called a function that search for the values user put and calculate them to update the fields of the missing ones with html dom. I'm trying to use a for loop to not write all them multiple times as it gets so confusing and with a lot lines of code.
Let's pretend i want to check if value is bigger than 0 or !="". alert(va) is giving me va1 to va5, but then I can't use it in the if loop. If change it for va1>0 it works. So any ideas to write this usefull in the if loop? Must be something very noobie, but my knowledge of javascript is almost nothing.
for(i = 1; i < 6; i++){
va ="va"+i;
vu = "vu"+i;
alert(va);
if(va>0){
alert("ok");
}
}
thanks
Aucun commentaire:
Enregistrer un commentaire