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.imple mentation && document.implem entation.create Document)
{
xmldoc = document.implem entation.create Document("", "", null);
}
else if (window.ActiveX Object)
{
// create a new XML object for IE
xmldoc=new ActiveXObject(" Microsoft.XMLDO M");
}
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('ne ws.xml');
// load the moves
newsItems = xmldoc.getEleme ntsByTagName("n ewselement");
// populate the Move Arrays from the XML file
for (var i=0;i<newsItems .length;i++)
{
// add the move
text[i]=newsItems[i].getElementsByT agName("headlin e")[0].firstChild.dat a;
header[i]=newsItems[i].getElementsByT agName("newsite m")[0].firstChild.dat a;
linka[i]=newsItems[i].getElementsByT agName("newslin k")[0].firstChild.dat a;
targa[i]=newsItems[i].getElementsByT agName("newstar get")[0].firstChild.dat a;
}
with the XML file being used as follows :
<newsticker>
<newselement>
<newsno>1</newsno>
<headline>Thi s is Headline 1</headline>
<newsitem>Thi s is NI 1</newsitem>
<newslink>hello World.html</newslink>
<newstarget>a </newstarget>
</newselement>
<newselement>
<newsno>2</newsno>
<headline>Thi s is Headline 2</headline>
<newsitem>Thi s is NI 2</newsitem>
<newslink>htt p://www.greggriffit hs.org/</newslink>
<newstarget>new </newstarget>
</newselement>
<newselement>
<newsno>3</newsno>
<headline>Thi s is Headline 3</headline>
<newsitem>Thi s is NI 3</newsitem>
<newslink>htt p://www.greggriffit hs.org/</newslink>
<newstarget>bla nk</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.imple mentation && document.implem entation.create Document)
{
xmldoc = document.implem entation.create Document("", "", null);
}
else if (window.ActiveX Object)
{
// create a new XML object for IE
xmldoc=new ActiveXObject(" Microsoft.XMLDO M");
}
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('ne ws.xml');
// load the moves
newsItems = xmldoc.getEleme ntsByTagName("n ewselement");
// populate the Move Arrays from the XML file
for (var i=0;i<newsItems .length;i++)
{
// add the move
text[i]=newsItems[i].getElementsByT agName("headlin e")[0].firstChild.dat a;
header[i]=newsItems[i].getElementsByT agName("newsite m")[0].firstChild.dat a;
linka[i]=newsItems[i].getElementsByT agName("newslin k")[0].firstChild.dat a;
targa[i]=newsItems[i].getElementsByT agName("newstar get")[0].firstChild.dat a;
}
with the XML file being used as follows :
<newsticker>
<newselement>
<newsno>1</newsno>
<headline>Thi s is Headline 1</headline>
<newsitem>Thi s is NI 1</newsitem>
<newslink>hello World.html</newslink>
<newstarget>a </newstarget>
</newselement>
<newselement>
<newsno>2</newsno>
<headline>Thi s is Headline 2</headline>
<newsitem>Thi s is NI 2</newsitem>
<newslink>htt p://www.greggriffit hs.org/</newslink>
<newstarget>new </newstarget>
</newselement>
<newselement>
<newsno>3</newsno>
<headline>Thi s is Headline 3</headline>
<newsitem>Thi s is NI 3</newsitem>
<newslink>htt p://www.greggriffit hs.org/</newslink>
<newstarget>bla nk</newstarget>
</newselement>
</newsticker>
Can anyone help me out with this as it is driving me nuts !!
Comment