473,405 Members | 2,379 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,405 software developers and data experts.

Making an Array from an XML with Firefox vs Explorer

Hello!

I've an XML like this:

Expand|Select|Wrap|Line Numbers
  1. <XML id=SlideShowData>
  2.  <SlideShowData>
  3.   <SLIDES>
  4.    <SLIDE FileName="filename1.jpg" Caption="descrizione1"/>
  5.    <SLIDE FileName="filename2.jpg" Caption="descrizione2"/>
  6.   </SLIDES>
  7.  </SlideShowData>
  8. </XML>
  9.  
My javascript should create an Array from this XML. It works with Explorer while returns "parent has no properties" error with Firefox.

This is the two functions:

Expand|Select|Wrap|Line Numbers
  1. function InitSlideData()
  2. {var SlidesNode = 
  3. FindChildNode(SlideShowData.documentElement, "SLIDES");  
  4.   if (SlidesNode == null)
  5.     return;
  6.   var ChildNodes = SlidesNode.getElementsByTagName("SLIDE");
  7.  
  8.   for (i = 0; i < ChildNodes.length; i++) 
  9.     {SlideImages[i] = ChildNodes.item(i).attributes.getNamedItem("FileName").value;
  10.     SlideCaptions[i] = ChildNodes.item(i).attributes.getNamedItem("Caption").value;
  11.     }
  12.  }
  13.  
  14. function FindChildNode(parent, name)
  15. { var ChildNodes = parent.getElementsByTagName(name); //here occurs the error!!
  16. for (i = 0; i < ChildNodes.length; i++)
  17.     if (ChildNodes.item(i).nodeName == name)
  18.       return ChildNodes.item(i);
  19. return null;    
  20. }
Please help me, thankyou in advance!
Em
Oct 16 '07 #1
3 1355
acoder
16,027 Expert Mod 8TB
On line 3, you use the variable SlideShowData. Where is it defined?
Oct 16 '07 #2
On line 3, you use the variable SlideShowData. Where is it defined?
It's not defined.
Isn't enough <XML id=SlideShowData>?
How should I define it?
Why with IExplorer it works?

thank you very much!
EM
Oct 17 '07 #3
acoder
16,027 Expert Mod 8TB
You can define it using:
Expand|Select|Wrap|Line Numbers
  1. var SlideShowData = document.getElementById("SlideShowData");
I shouldn't work in IE either, but it messes things up with IDs by making them accessible globally.
Oct 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: kinne | last post by:
The following code is supposed to reverse the date in "yyyy-mm-dd" format, but it produces different results in Firefox 1.0 and in Internet Explorer 6SP1. In Firefox, the result is correct...
4
by: Next Generation Technologies Inc. | last post by:
Now what I have is a function that only works in WinIE4+ because it's uses Microsoft proprietary properties and methods: function gmshortcutkeys() { if ((parseInt(navigator.appVersion) >= 4)...
3
by: Sandy Bremmer | last post by:
I was curious how one goes about properly creates a table row with multiple TD cells as a single hyperlink because I have seen examples of what I think is invalid and poorly conceived HTML. It...
2
by: Stewart | last post by:
Originally posted in comp.lang.javascript: Newsgroups: comp.lang.javascript From: "Stewart" Date: 23 Aug 2005 02:50:04 -0700 Local: Tues, Aug 23 2005 10:50 am Subject: FireFox, RemoveChild,...
2
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
21
by: PlainDave | last post by:
Hi, Is there a way to make windows tooltips stay up longer than the default 5 seconds using CSS in a web page? I'd prefer to have it stay visible as long as the mouse is over the "whatever." The...
3
by: google | last post by:
I am trying to complete a javascript application and am having problems with code similar to that show below. Much testing has shown that Firefox finishes the code shown in around 0.25 secs but...
8
by: golfchick | last post by:
Well im at the end of my teather, ive been searching for an answer to no avail. Ive used suggested html and css checkers both say my code is perfect and yet there seems to be a distinct difference...
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.