Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-02-2004, 05:11 PM   PM User | #1
JAVAEOC
Regular Coder

 
Join Date: Oct 2003
Location: SC
Posts: 936
Thanks: 0
Thanked 0 Times in 0 Posts
JAVAEOC is an unknown quantity at this point
Total amount of nodes in a document

How can I get the number of total amounts of objects in my document???


thanks
__________________
http://www.bluephoenix.uni.cc/
JAVAEOC is offline   Reply With Quote
Old 05-02-2004, 06:45 PM   PM User | #2
nolachrymose
Regular Coder

 
Join Date: Jun 2002
Posts: 338
Thanks: 0
Thanked 0 Times in 0 Posts
nolachrymose is an unknown quantity at this point
By "total amount of nodes," do you mean *all* nodes (attribute notes, comments, etc.), or do you really mean "total amount of elements," or something different?

Also, out of curiosity: what is the purpose of finding the number of nodes in the document?

Happy coding!
nolachrymose is offline   Reply With Quote
Old 05-02-2004, 07:21 PM   PM User | #3
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
You can get all element nodes via document.getElementsByTagName("*"). If you want all nodes, a DOM2 NodeIterator is what you'd want to use ideally, though no browser supports it. A recursive call pushing nodes onto a stack would achieve the same thing though.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 05-02-2004, 07:26 PM   PM User | #4
JAVAEOC
Regular Coder

 
Join Date: Oct 2003
Location: SC
Posts: 936
Thanks: 0
Thanked 0 Times in 0 Posts
JAVAEOC is an unknown quantity at this point
yea, I need the * , cuz I want to find all elements and assign them A ID if they dont have one laready
__________________
http://www.bluephoenix.uni.cc/
JAVAEOC is offline   Reply With Quote
Old 05-02-2004, 11:45 PM   PM User | #5
squirellplaying
Regular Coder

 
Join Date: Jan 2004
Location: Maryland
Posts: 468
Thanks: 0
Thanked 0 Times in 0 Posts
squirellplaying is an unknown quantity at this point
What is a node?
squirellplaying is offline   Reply With Quote
Old 05-02-2004, 11:50 PM   PM User | #6
Antoniohawk
Senior Coder

 
Join Date: Aug 2002
Location: Kansas City, Kansas
Posts: 1,518
Thanks: 0
Thanked 2 Times in 2 Posts
Antoniohawk will become famous soon enough
Already been covered: [http://www.codingforums.com/showthread.php?t=36898]
Antoniohawk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:36 AM.


Advertisement
Log in to turn off these ads.