File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Working with html Nodes Re phrased Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Working with html Nodes Re phrased" Watch "Working with html Nodes Re phrased" New topic
Author

Working with html Nodes Re phrased

Stephen Black
Ranch Hand

Joined: Aug 13, 2009
Posts: 31

All I want to do is to refer to the elements with the id= CatBreeds, DogBreeds and BirdBreeds
and then I want to make those nodes invisible.
I want to do this without refering to the id of these nodes
and I would like to do it using a loop

Here is a link to my current attempt to solve this problem
----------------------------------------------------------


[edited: to use code tags]
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

I want to do this without refering to the id of these nodes


I wonder why don't you want to do this using the easiest way possible. Anyways, you can use the child elements property on an element to get all the child elements as node list and then iterate over it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Stephen Black
Ranch Hand

Joined: Aug 13, 2009
Posts: 31

Thanks for that
The reason why I want to do things the hard way is becuause
Imagine if the list was not just a static list but imagine if it was a considerably long PHP generated database query
Thats why I believe the hard way (not referring to Id's) is the best way.

Anyhow after considerable experimentation I think I have it sorted out
The hardest thing about coding this is that it's hard to step throuht the script mentally
if you don't really understand fully the way the DOM is set out.

Ankit Garg wrote:
I want to do this without refering to the id of these nodes


I wonder why don't you want to do this using the easiest way possible. Anyways, you can use the child elements property on an element to get all the child elements as node list and then iterate over it...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Working with html Nodes Re phrased
 
Similar Threads
HTML drop downs not working
Struts Taglibs issues while including html in jsp
Not achieving space between div blocks containing lists
Dynamic Drop Down Menu
display items using java script