|
-
Jan 18th, 2005, 01:52 PM
#1
Thread Starter
New Member
using getElementsByTagName in Netscape 7
I've seen this problem in a number of other forums, but haven't found a solution yet.
I'm using a menu for a web page that gets its items from an xml document. An example of an item in this xml document would be:
<menu>
<menuitem>
<node>1</node>
<parent>0</parent>
<label>Home</label>
<link>frmHome.aspx</link>
</menuitem>
</menu>
My problem seems to be with the following line in javascript:
var menuItems = xmldoc.getElementsByTagName("menuitem");
This code should store all of the menuitems in the menuItems variable. When I try to find the length of 'menuItems' in IE it returns the correct number (41). FireFox also find 41 items. With Netscape 7 however, the length is returned as 0, and so it says that no menu items have been defined.
Anyone know why it would be doing this, and if Netscape has a different version of getElementsByTagName?
thanks.
edit: my problem may also be with loading the document. At the moment i use xmldoc.load("menu.xml") for both IE and Netscape. When i put xmldoc.xml in an alert --- alert(xmldoc.xml) --- it shows the entire xml document in the alert box with IE, but it shows as 'undefined' in Netscape.
Is there a different way to load the xml document in Netscape 7?
Last edited by muri; Jan 18th, 2005 at 03:51 PM.
-
Jan 19th, 2005, 10:26 AM
#2
Re: using getElementsByTagName in Netscape 7
FireFox and Netscape 7 are essentially the same program, but 7 is a far older version. I believe it's too old to support the loading of documents.
Try 7.2 for a moment, I believe it should work there.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|