bobbybrown69
Programmer
How would I go about allowing oNewTd4 be whatever l+1 is equal to in this for loop. I have it hardcoded as oNewTd4 and oNewTd4 but sometimes it might need to be 6 or 8 or 11, etc.
I thought this would work but it didn't.
eval("oNewTd"+(l+1));
--------------------------------
for(var l=0, field, elm; field=lblFieldOrder[l++] {
oNewTd = "";
if ((field == "Year4") || (field == "Year2")){
if (linerYear4 != ""){
oNewTd = eval("oNewTd"+(l+1));
oNewTd4 = document.createElement("td");
}
if (linerYear2 != ""){
oNewTd = eval("oNewTd"+(l+1));
oNewTd4 = document.createElement("td");
}
}
if (field == "Model"){
oNewTd = eval("oNewTd"+(l+1));
oNewTd3 = document.createElement("td");
}
}
I thought this would work but it didn't.
eval("oNewTd"+(l+1));
--------------------------------
for(var l=0, field, elm; field=lblFieldOrder[l++] {
oNewTd = "";
if ((field == "Year4") || (field == "Year2")){
if (linerYear4 != ""){
oNewTd = eval("oNewTd"+(l+1));
oNewTd4 = document.createElement("td");
}
if (linerYear2 != ""){
oNewTd = eval("oNewTd"+(l+1));
oNewTd4 = document.createElement("td");
}
}
if (field == "Model"){
oNewTd = eval("oNewTd"+(l+1));
oNewTd3 = document.createElement("td");
}
}