building dynamic tables cells and specifying colspan

Giganews Newsgroups
Subject: building dynamic tables cells and specifying colspan
Posted by:  rsdebo…@yahoo.com (rsd)
Date: 7 Jul 2003

how do you specify the "colspan" attribut of a <td> cell when building
the table/rows/cells dynamicly?

ie: lets say we have the follwoing code:

table = document.all["resTable"];
// header row
tr1 = table.insertRow();
td1 = tr1.insertCell();
td1.innerHTML = "this is the header row";
// data row
tr2 = table.insertRow();
td1 = tr2.insertCell()
td1.innerHTML = "column one";
td2 = tr2.insertCell();
td2.innerHTML = "column two";
td3 = tr2.insertCell();
td3.innerHTML = "column three";

for the 1st row's only cell, how would you specify the colspan for the
cell?
normal in HTML it would be <td colspan=3>. i can specify different
atributes by using "td1.height", "td1.style.background", ect, but
"td.colspan=3" just doesnt work.

also, this will only be used with ie browsers, thanks for any help,

rsd

Replies