Hi everyone,
I am trying to do the following with XML and Javascript:
[INDENT]If the XML tag <note> is not “NONE”, show the table row.
Else display: none;[/INDENT]
<script>
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","sample.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
n = xmlDoc.getElementsByTagName("note")[0].childNodes[0].nodeValue;
var y=xmlDoc.getElementsByTagName("canceledDate");
for (j=0;j<y.length;j++){
if (n != "NONE"){
document.write("<tr>");
document.write("<td colspan='4'>");
document.write(y[j].getElementsByTagName("note")[0].childNodes[0].nodeValue);
document.write("</td>");
document.write("</tr>");
}else{
document.getElementsByTagName("note").style.display = 'none';
}
}
</script>
My html page is showing up blank, and I’m missing understanding on how to figure this out at the moment. I had the page showing all content a bit ago, but now I lost it. I’m not sure if I stepped forward or backward a step toward a solution. Any help would be greatly appreciated. I hope I put this in the right section as it could be a JavaScript forum question too.
Thank you in advance for your time and help.