i have the following code which creates tr and td elements then adds them to a table. combArray is a global array and there are no problems inserting all the values. the only problem is assigning a colspan = 7 has no effect; everything is still squished into 1 row. The entire function runs and is not crashing. i even try and assign colspan twice, once on line 11 and again after the row has been appended at the end of the function on line 40. why isnt colspan working?! thanks in advance, Geoff
<script type="text/javascript">
function fillVariables( idDigit ) {
var tbody = document.getElementById("zrow" + idDigit + "tbody");
var newNodeText = "";
var varCount = 1;
var fixedCount = 1;
for (var x = 0; x < combArray.length; x++ ) {
var newNodeTr = document.createElement("tr");
var newNodeTd = document.createElement("td");
newNodeTd.colspan = 7;
newNodeTd.id = "td1" + idDigit;
//newNodeTd.colspan = 2;
if (combArray[x][4] == "yes") {
newNodeText = "Variable ingredient " + varCount + ": " + combArray[x][0] + " (" + combArray[x][1] + ") ";
if (combArray[x][2] != "") { // combArray ingredient uses SA
var SAObj = fractionToDecimal (combArray[x][2]);
newNodeText = newNodeText + "<input id=\\"varval_" + idDigit + "_" + x + "\\" type=\\"text\\" size=\\"3\\" value=\\"" + formatFTD( SAObj ) + "\\" /> ";
newNodeText = newNodeText + "<span id=\\"varsa_" + idDigit + "_" + x + "\\">" + SAObj.text + "</span>";
} else {
newNodeText = newNodeText + "<input id=\\"varval_" + idDigit + "_" + x + "\\" type=\\"text\\" size=\\"3\\" value=\\"" + parseFloat( combArray[x][3] ) + "\\" /> ";
newNodeText = newNodeText + createUnitSelect( combArray[x][3], "varss_" + idDigit + "_" + x );
}
varCount += 1;
} else {
newNodeText = "Fixed ingredient " + fixedCount + ": " + combArray[x][0] + " (" + combArray[x][1] + ") ";
if (combArray[x][2] != "") { // combArray ingredient uses SA
newNodeText = newNodeText + combArray[x][2];
} else { //combArray ingredient uses SS/
newNodeText = newNodeText + combArray[x][3];
}
fixedCount += 1;
}
newNodeTd.innerHTML = newNodeText;
newNodeTr.appendChild(newNodeTd);
tbody.appendChild(newNodeTr);
document.getElementById("td1" + idDigit).colspan = 7;
alert("check14. this shows up meaning function does not crash.");
}
}
</script>