Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to insert row into an html table

0 views
Skip to first unread message

tones...@hotmail.com

unread,
Jan 2, 2001, 8:00:26 AM1/2/01
to
hi guys,

can anyone give me a sample script on how to insert a row at a time
into an html table, more importantly, are there any differences while
implementing on NN and IE?

Thank you!! and Happy new year!!

tony


Sent via Deja.com
http://www.deja.com/

bitrunner

unread,
Jan 2, 2001, 9:26:07 AM1/2/01
to
A table is a static object, so you can't insert rows nor columns
dynamically. If you want it to grow you need to rebuild your page.

Peter Shore

unread,
Jan 2, 2001, 8:06:00 PM1/2/01
to

NN6 uses standard DOM Level-2 syntax,
So you'd insert a new table row exactly the same
way you'd insert any other new element into a document ....

with (document){
var x=createElement('TR'), y=createElement('TD');
y.innerHTML="This New Cell's Text";
x.appendChild(y);
getElementById['myTable'].appendChild(x)}


IE 4.0-5.5 still uses an older non-W3C proprietory method....

var y=myTable.insertRow(), x=y.insertCell();
x.innerText="This New Cell's Text";

IE3, NN4, Opera 4....
- No can do. Not sure about Opera 5, but should be same as NN6.

- Peter

<tones...@hotmail.com> wrote in message news:92sjd8$pfc$1...@nnrp1.deja.com...

Peter Shore

unread,
Jan 2, 2001, 11:43:23 PM1/2/01
to

"bitrunner" <bitr...@ANTISPAM.terra.es> wrote in message news:3A51E4FF...@ANTISPAM.terra.es...

> A table is a static object, so you can't insert rows nor columns
> dynamically. If you want it to grow you need to rebuild your page.

For the record, there are no "static" objects any more between the
<body></body> tags in modern browsers. Any element is insertable,
editable, deletable.

Your statements above would have been false as far back as 3 years
ago, when IE4.0 supported methods for the insertion and deletion of
table elements.

- Peter

dave...@my-deja.com

unread,
Jan 3, 2001, 9:22:58 AM1/3/01
to

> For the record, there are no "static" objects any more between the
> <body></body> tags in modern browsers. Any element is insertable,
> editable, deletable.

Eh. If you're shooting for backwards compatability (read: ECMAScript
by the book), that ain't true, either.
I try to avoid browser-specific code...

dave

D. Robert Hamm

unread,
Jan 5, 2001, 10:59:42 PM1/5/01
to
You can use document.write as part of a conditional loop, I guess, but why
do you need to add rows on the fly?

Tell me more about what you're doing and I may be able to help.

0 new messages