473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

walking the DOM

I'm unsure of an efficient way of doing this.

I have nested lists that I want to collapse/expand:

<ul>
<li>find following nested list (ul) by using a reference to this node
<ul>
<li>...

Doing this by looking through childNodes seems crazy. Isn't there a way to
find the next node? A better way?

Jeff


Jul 23 '05 #1
2 1592
"Jeff Thies" <no****@nospam.net> wrote:
I have nested lists that I want to collapse/expand:
<ul>
<li>find following nested list (ul) by using a reference to this node
<ul>
<li>...
Doing this by looking through childNodes seems crazy. Isn't there a way to
find the next node? A better way?


Why does it seem crazy?

By the way, if you're looking to turn <ul> lists into expandable/collapsable
trees, you can use and/or look at my code which does exactly this:
http://www.mattkruse.com/javascript/mktree/

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Jul 23 '05 #2

"Matt Kruse" <ne********@mattkruse.com> wrote in message
news:c6********@news2.newsguy.com...
"Jeff Thies" <no****@nospam.net> wrote:
I have nested lists that I want to collapse/expand:
<ul>
<li>find following nested list (ul) by using a reference to this node
<ul>
<li>...
Doing this by looking through childNodes seems crazy. Isn't there a way to find the next node? A better way?
Why does it seem crazy?


You're right. It wasn't that hard.

By the way, if you're looking to turn <ul> lists into expandable/collapsable trees, you can use and/or look at my code which does exactly this:
http://www.mattkruse.com/javascript/mktree/
Pretty cool!

What's the scrollIntoView do?

My funky version (30 lines):

http://thelimit.com/test/test_list2.htm

Forgot how to change background images.

Cheers,
Jeff

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: evski | last post by:
kia ora I am after a set of php script to administer bookings for buses and huts and coordinate customer enquiries in our small tourism business I have looked extensively but not come up with...
2
by: Who Cares | last post by:
Okay, this may be a bit of a newbie question but I could really use some help. I want to write a set of routines that will read in the contents of XML files. I'll be reading the tag names,...
0
by: Chris Lyon | last post by:
I handle a lot of audio files of different formats, which live in a directory tree. WAV files in a wav directory, AIFF's in an AIFF directory next to the wav directory and mp3's in an MP3 directory...
2
by: mr.happy | last post by:
Hi all, I have this little question, basicly i solved it already by writing a little bit of code for it (using recursion), but still i am wondering if there is a shorter ways to do things (like...
2
by: David Stockwell | last post by:
snippet payload = {} try: message = email.message_from_string(message) messageHeader = dict(message._headers) addressFrom = messageHeader addressReply = messageHeader.get("Reply-To")...
4
by: Jim Bancroft | last post by:
Sorry for the basic nature of this question. I know XSL can do this, but I don't recall a good method... Say I have an xml structure like this: <folder_structure> <folder name="folder1">...
1
by: Zachary Hartnett | last post by:
I was trying to write a routine this morning that would open a given assembly, walk the inheritance tree of classes in the assembly, and provide a list of classes in the assembly that inherit from...
5
by: TrulyUnusualdotcom | last post by:
I'm reading PHP & MySQL for Dummies 2nd edition...ya ya I know..lame. Anyway I got to the part about walking through an array and I just can't seem to figure out what this would be used for. What...
8
by: Ben Hallert | last post by:
Hi guys! I'm working on a little javascriptlet/greasemonkey script, and I've run into a challenge that I think can be solved with walking the DOM, but I feel like I'm kludging my way through and...
11
by: Simon Woods | last post by:
Hi I have this recursive function and I want to walk the inheritance hierarchy to set field values .... the generic T is constrainted as the base class of the inheritance hierarchy Friend...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.