P
Peach
Hi there-
I am new to javascript and I am simply trying to display XML data in
an html doc using javascript. When I try to display a set of elements
and one or more of them are empty XML tags (ie. <show1></show1> OR </
show1>) it crashes my page. I don't know how to fix it.
Here is some code, which I think will give you an idea of what I am
trying to do:
var x=xmlDoc.getElementsByTagName("innovative");
function show(i)
{
name=(x.getElementsByTagName("name")[0].childNodes[0].nodeValue);
nomination=(x.getElementsByTagName("nomination")
[0].childNodes[0].nodeValue);
show1=(x.getElementsByTagName("show1")[0].childNodes[0].nodeValue);
show2=(x.getElementsByTagName("show2")[0].childNodes[0].nodeValue);
link1=(x.getElementsByTagName("link1")[0].childNodes[0].nodeValue);
link2=(x.getElementsByTagName("link2")[0].childNodes[0].nodeValue);
href="+link2+">"+link2+"</a>" ;
document.getElementById("show").innerHTML=txt;
}
Can anyone help? I really want this page to work.
I am new to javascript and I am simply trying to display XML data in
an html doc using javascript. When I try to display a set of elements
and one or more of them are empty XML tags (ie. <show1></show1> OR </
show1>) it crashes my page. I don't know how to fix it.
Here is some code, which I think will give you an idea of what I am
trying to do:
var x=xmlDoc.getElementsByTagName("innovative");
function show(i)
{
name=(x.getElementsByTagName("name")[0].childNodes[0].nodeValue);
nomination=(x.getElementsByTagName("nomination")
[0].childNodes[0].nodeValue);
show1=(x.getElementsByTagName("show1")[0].childNodes[0].nodeValue);
show2=(x.getElementsByTagName("show2")[0].childNodes[0].nodeValue);
link1=(x.getElementsByTagName("link1")[0].childNodes[0].nodeValue);
link2=(x.getElementsByTagName("link2")[0].childNodes[0].nodeValue);
target=_blank href="+link1+">"+link1+"</a><br />"+"<a target=_blanktxt="Comic: "+name+show1test+ said:Upcoming Sets: <br/>"+show1+"<br />"+show2+"<br />Links: <a
href="+link2+">"+link2+"</a>" ;
document.getElementById("show").innerHTML=txt;
}
Can anyone help? I really want this page to work.