Garadon
01-17-2004, 11:47 AM
I got this code
Div= document.createElement("div");
Table= document.createElement("table");
Table.setAttribute("style","width:100px;height:100px;background-color : #708090;");
Table.setAttribute("bgColor","#708090");
tr=document.createElement("tr");
td=document.createElement("td");
text=document.createTextNode(aText);
myTableBody = document.createElement("TBODY")
td.appendChild(text);
tr.appendChild(td);
myTableBody.appendChild(tr);
Table.appendChild(myTableBody);
Div.appendChild(Table);
document.getElementsByTagName('body').item(0).appendChild(Div);
Now it all works fine with the exception of the
Table.setAttribute("style","width:100px;height:100px;background-color : #708090;");
so I was wondering how do I set the style attribute in the table node?
Div= document.createElement("div");
Table= document.createElement("table");
Table.setAttribute("style","width:100px;height:100px;background-color : #708090;");
Table.setAttribute("bgColor","#708090");
tr=document.createElement("tr");
td=document.createElement("td");
text=document.createTextNode(aText);
myTableBody = document.createElement("TBODY")
td.appendChild(text);
tr.appendChild(td);
myTableBody.appendChild(tr);
Table.appendChild(myTableBody);
Div.appendChild(Table);
document.getElementsByTagName('body').item(0).appendChild(Div);
Now it all works fine with the exception of the
Table.setAttribute("style","width:100px;height:100px;background-color : #708090;");
so I was wondering how do I set the style attribute in the table node?