K
karsagarwal
Hi,
I am getting the error:
document.getElementById("layer" + i) has no prperties and have no
clue as to what it's not liking. Any inputs would be helpful....
I am including the code below:
Thanks!!
------------------------------------------------------------------------
function parseXML()
{
debugger;
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e)
{
alert(e.message);
return;
}
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("cnn_topstories.xml");
xtitle=xmlDoc.getElementsByTagName("title");
xdesc =xmlDoc.getElementsByTagName("description");
for (i=0;i<xtitle.length;i++) {
y=xtitle.childNodes[0].nodeValue;
z=xdesc.childNodes[0].nodeValue;
document.getElementById("layer" + i).innerHTML=y;
}
}
//
document.getElementById(i).innerHTML=xmlDoc.getElementsByTagName("item")
[0].childNodes[0].nodeValue;
//
document.getElementById("1").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("2").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("3").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("4").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
}
</script>
</head>
<body>
<div id="rotate"><p>test</p>
<p><b>Item Title:</b><span id="layer0"; style="position:absolute; top:
0px; left:0px; width:50px; height:50px; background-color:red;
border:solid 1px white; vidibility:hidden "></span><br
/>
<span id="layer1"; style="position:absolute; top:20px; left:20px;
width:50px; height:50px; background-color:blue; border:solid 1px
white; "></span><br />
<span id="layer2"; style="position:absolute; top:40px; left:40px;
width:50px; height:50px; background-color:green; border:solid 1px
white; "></span><br />
<span id="layer3"; style="position:absolute; top:50px; left:50px;
width:50px; height:50px; background-color
urple; border:solid 1px
white; "></span><br />
<span id="layer4"; style="position:absolute; top:60px; left:60px;
width:50px; height:50px; background-color:yellow; border:solid 1px
white; "></span><br />
</div>
<SCRIPT type="text/javascript">parseXML() </script>
-->
</body>
I am getting the error:
document.getElementById("layer" + i) has no prperties and have no
clue as to what it's not liking. Any inputs would be helpful....
I am including the code below:
Thanks!!
------------------------------------------------------------------------
function parseXML()
{
debugger;
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e)
{
alert(e.message);
return;
}
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("cnn_topstories.xml");
xtitle=xmlDoc.getElementsByTagName("title");
xdesc =xmlDoc.getElementsByTagName("description");
for (i=0;i<xtitle.length;i++) {
y=xtitle.childNodes[0].nodeValue;
z=xdesc.childNodes[0].nodeValue;
document.getElementById("layer" + i).innerHTML=y;
}
}
//
document.getElementById(i).innerHTML=xmlDoc.getElementsByTagName("item")
[0].childNodes[0].nodeValue;
//
document.getElementById("1").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("2").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("3").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
//
document.getElementById("4").innerHTML=xmlDoc.getElementsByTagName("title")
[0].childNodes[0].nodeValue;
}
</script>
</head>
<body>
<div id="rotate"><p>test</p>
<p><b>Item Title:</b><span id="layer0"; style="position:absolute; top:
0px; left:0px; width:50px; height:50px; background-color:red;
border:solid 1px white; vidibility:hidden "></span><br
/>
<span id="layer1"; style="position:absolute; top:20px; left:20px;
width:50px; height:50px; background-color:blue; border:solid 1px
white; "></span><br />
<span id="layer2"; style="position:absolute; top:40px; left:40px;
width:50px; height:50px; background-color:green; border:solid 1px
white; "></span><br />
<span id="layer3"; style="position:absolute; top:50px; left:50px;
width:50px; height:50px; background-color
white; "></span><br />
<span id="layer4"; style="position:absolute; top:60px; left:60px;
width:50px; height:50px; background-color:yellow; border:solid 1px
white; "></span><br />
</div>
<SCRIPT type="text/javascript">parseXML() </script>
-->
</body>