...

View Full Version : Various XML DOM Questions



Antoniohawk
07-08-2004, 03:53 AM
I have a couple questions and more will probably be added later. I'm working on a project where a wishlist is created from an xml file. The following are the files that make up the list.

xhtml: [http://null.ithium.net/andrew/NewGenMenuTree/wishlist2.html]
css: [http://null.ithium.net/andrew/NewGenMenuTree/wishlist2.css]
js: [http://null.ithium.net/andrew/NewGenMenuTree/menuTree.js]
xml: [http://null.ithium.net/andrew/NewGenMenuTree/wishlist2.xml]
xmlLoader: [http://null.ithium.net/andrew/NewGenMenuTree/xmlLoader.html]

The first question, is how to properly add the events to the links where the list item contains children.

<a href="#" class="parent" onclick="door(this); return false">Wishlist</a>
The two options that I saw, were either adding the onclick as an attribute, or using the addEventListener method. I'm guessing that the former might not work, and do not know how to use the latter.

I just read on Mozilla's DOM Reference that you can use element.onclick, maybe that is the way to go.

My next question, is how to add the text within the <a> and </a>.

-----=-----=-----=-----
There are a zealous few out there that would like nothing better than to do this for me. Please refrain from doing so, so that I can see what I can accomplish myself. :)
-----=-----=-----=-----

Antoniohawk
08-04-2004, 08:09 AM
I'm gonna start working on this again, so this thread needs a bump. :)

neofibril
08-08-2004, 10:59 PM
So, which question are you bumping, and who are the "zealous few"? (A rather pretentious statement, it seems.)

Antoniohawk
08-18-2004, 01:05 AM
Any question that someone can answer is a big help to me. If you feel that being zealous is a bad thing then I'm sorry that you do so. :)

neofibril
08-19-2004, 04:19 AM
Well, I don't feel that way, necessarily; besides, my point was that it seemed pretentious to state that others had nothing better to do than solve your problems.

Asking about which question you were calling attention to was my attempt to hint that you might do a bit more than link to various source code to define your problems; something along the lines of providing a test that isn't quite working, for example, might get more responses (based on the fact that very few well-presented questions go unanswered around here).

Good luck. :)

Antoniohawk
08-19-2004, 04:44 AM
I know that a lot of people out there don't have the time to do it for me, but there are some people on this board that have done just that before. I guess that the question that I most want answered is the one about assigning events to an element that I create via my xml. I could test a bunch of methods that I don't really know how to use and then have some work, but I'm more interested in the correct method to use and how to use it. I have figured out how to get the value of the <a> elements by using element.firstChild.nodeValue, so that is no longer a problem. Thanks for any help that can be provided. :)

neofibril
08-19-2004, 05:23 AM
Here's a browser/event comparison table, which may help you determine what's best: http://www.quirksmode.org/dom/w3c_events.html
As for how to use methods conditionally, I guess it depends...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum