Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: Re: SV: The DOM and Tables


Message #1 by "Robert Nyman" <robert.nyman@c...> on Tue, 22 Oct 2002 10:10:27 +0200
Hi,

Good thing that you found your ways...  :-)

If possible, DOM is really the way to go!


/Robert



-----Ursprungligt meddelande-----
Fr=E5n: plscribner@w... [mailto:plscribner@w...]
Skickat: den 19 oktober 2002 03:02
Till: javascript
=C4mne: [javascript] Re: SV: The DOM and Tables


Hi Robert,

Thanks for your reply - genuinely appreciated.  With your help and a
look
at at the references you provided I have found 2 of the millions of ways

to do this that work really well for me :-)  DOM is definately the way
to
go for what I need.

Thanks again.

Peter

> Hi Peter,

As I see it, there are two different approaches to this:

1. Using the TABLE methods insertRow() and insertCell(), and giving them
IDs.

2. Using the advancaed approach, wich will be:

For instance, adding a cell:

function addCell(){
	var oTD =3D3D document.createElement("td");
	oTD.setAttribute("id", uniqueID); // uniqueID is IE specific,
but it's easy to create a counter and then have different IDs.
	var oText =3D3D document.createTextNode("This is the content of
the TD...");
	oTD.appendChild(oText);
	var oTable =3D3D document.getElementById("myTable");
	var oTR =3D3D oTable.getElementsByTagName("tr")[1]; // This will
choose the TABLE's second row
	oTR .appendChild(oTD);
}


This is merely an example, there are millions of way to do this. I'd
recommend that you read about this and just play around with the methods
and your imagination.


More info:

Scott's list of methods and properties
(http://www.scottandrew.com/weblog/articles/dom_6)
DOM Elements Interface
(http://www.mozilla.org/docs/dom/domref/dom_el_ref.html#1002691)


/Robert



-----Ursprungligt meddelande-----
Fr=3DE5n: plscribner@w...
[mailto:plscribner@w...]=3D20
Skickat: den 13 oktober 2002 09:58
Till: javascript
=3DC4mne: [javascript] The DOM and Tables


Hi everyone,

Thanks for taking the time to read this.  I am trying to learn to create

dynamic tables using the DOM.  Using JScript's table object is easy
enough=3D20 to figure out but not flexible enough.  I have searched for 
a
working=3D20 example of DOM based table but haven't gotten anywhere - 
even
the single

example at Microsoft MSDN doesn't work.

I need to be able to add rows, cells within rows and the usual stuff but

also need to be able to reference cells by their name.

Anybody got any examples or advice on where I can find any, it sure
would=3D20 help.

Thanks in advance.....
Peter

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3D3Dnosim/theprogra
m
m=3D
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or=3D20 to
unsubscribe send a blank email to 


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20


  Return to Index