|
-
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.
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
|