- From: L. David Baron <dbaron@fas.harvard.edu>
- Date: Sun, 16 May 1999 17:03:19 -0400 (EDT)
- To: hari@skyweb.net, www-dom@w3.org
On Sat, 15 May 1999 12:51:36 -0400, Hariharan Krishnan
(hari@skyweb.net) wrote:
> I was trying to construct a html table using DOM (Level 1 HTML). I found
> insertRow which returns rowelement and insertcell which inserts a cell
> in each row. However, i cannot find any API to fill the contents of a
> cell. Can someone please
> let me know what i am missing ? How can i insert content into each cell
> in a table ?
The way I would do it is to create a text node and then make that text
node the content of the table cell. This may be the only way. Thus
you could have a function like the following ECMAScript:
function makeTDWithText ( textstring ) {
// returns a TD element with text textstring inside
tdElem = document.createElement("td");
tdElem.appendChild ( document.createTextNode( textstring ) );
return tdElem;
}
Many of the functions needed for manipulating text are in the DOM level
one core, rather than the DOM level 1 HTML.
David
L. David Baron Freshman, Harvard dbaron@fas.harvard.edu
Links, SatPix, CSS, etc. < http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC < http://www.webstandards.org/css/ >
Received on Sunday, 16 May 1999 17:03:25 UTC