G
Greg Griffiths
Dear All,
I've got a small JS app that uses XML and I've got it working fine
in IE, but not in NN, I've used plenty of the samples on the web with my
Netscape Communicator and NN 6.1 but they just to seem to solve the
problem. The relevant code is below :
var text = new Array();
var header = new Array();
var linka = new Array();
var targa = new Array();
var newsItems;
// create an XMLDoc
var xmldoc;
if (document.implementation && document.implementation.createDocument)
{
xmldoc = document.implementation.createDocument("", "", null);
}
else if (window.ActiveXObject)
{
// create a new XML object for IE
xmldoc=new ActiveXObject("Microsoft.XMLDOM");
}
else
{
alert('Your browser can\'t handle this script');
}
// define some attributes of the doc
xmldoc.async = false;
//load the XML file in
xmldoc.load('news.xml');
// load the moves
newsItems = xmldoc.getElementsByTagName("newselement");
// populate the Move Arrays from the XML file
for (var i=0;i<newsItems.length;i++)
{
// add the move
text=newsItems.getElementsByTagName("headline")[0].firstChild.data;
header=newsItems.getElementsByTagName("newsitem")[0].firstChild.data;
linka=newsItems.getElementsByTagName("newslink")[0].firstChild.data;
targa=newsItems.getElementsByTagName("newstarget")[0].firstChild.data;
}
with the XML file being used as follows :
<newsticker>
<newselement>
<newsno>1</newsno>
<headline>This is Headline 1</headline>
<newsitem>This is NI 1</newsitem>
<newslink>helloWorld.html</newslink>
<newstarget>a</newstarget>
</newselement>
<newselement>
<newsno>2</newsno>
<headline>This is Headline 2</headline>
<newsitem>This is NI 2</newsitem>
<newslink>http://www.greggriffiths.org/</newslink>
<newstarget>new</newstarget>
</newselement>
<newselement>
<newsno>3</newsno>
<headline>This is Headline 3</headline>
<newsitem>This is NI 3</newsitem>
<newslink>http://www.greggriffiths.org/</newslink>
<newstarget>blank</newstarget>
</newselement>
</newsticker>
Can anyone help me out with this as it is driving me nuts !!
I've got a small JS app that uses XML and I've got it working fine
in IE, but not in NN, I've used plenty of the samples on the web with my
Netscape Communicator and NN 6.1 but they just to seem to solve the
problem. The relevant code is below :
var text = new Array();
var header = new Array();
var linka = new Array();
var targa = new Array();
var newsItems;
// create an XMLDoc
var xmldoc;
if (document.implementation && document.implementation.createDocument)
{
xmldoc = document.implementation.createDocument("", "", null);
}
else if (window.ActiveXObject)
{
// create a new XML object for IE
xmldoc=new ActiveXObject("Microsoft.XMLDOM");
}
else
{
alert('Your browser can\'t handle this script');
}
// define some attributes of the doc
xmldoc.async = false;
//load the XML file in
xmldoc.load('news.xml');
// load the moves
newsItems = xmldoc.getElementsByTagName("newselement");
// populate the Move Arrays from the XML file
for (var i=0;i<newsItems.length;i++)
{
// add the move
text=newsItems.getElementsByTagName("headline")[0].firstChild.data;
header=newsItems.getElementsByTagName("newsitem")[0].firstChild.data;
linka=newsItems.getElementsByTagName("newslink")[0].firstChild.data;
targa=newsItems.getElementsByTagName("newstarget")[0].firstChild.data;
}
with the XML file being used as follows :
<newsticker>
<newselement>
<newsno>1</newsno>
<headline>This is Headline 1</headline>
<newsitem>This is NI 1</newsitem>
<newslink>helloWorld.html</newslink>
<newstarget>a</newstarget>
</newselement>
<newselement>
<newsno>2</newsno>
<headline>This is Headline 2</headline>
<newsitem>This is NI 2</newsitem>
<newslink>http://www.greggriffiths.org/</newslink>
<newstarget>new</newstarget>
</newselement>
<newselement>
<newsno>3</newsno>
<headline>This is Headline 3</headline>
<newsitem>This is NI 3</newsitem>
<newslink>http://www.greggriffiths.org/</newslink>
<newstarget>blank</newstarget>
</newselement>
</newsticker>
Can anyone help me out with this as it is driving me nuts !!