I am trying to list all categories in my XML file and link them with a javascript function which opens an xsl file.
I'keep getting this error: Novel is Undefined. where Novel is a category from the XML
Here is my code.
var root=myxmldoc.getElementsByTagName("CATEGORY");
for (i=0;i<root.length;++i) {
var catName=(root[i].childNodes[0].nodeValue);
txt='<a href="#" onClick="javascript:Navigate('+catName+')">'+catName+'</a>';
document.getElementById("left-sidebar").innerHTML+=txt;
}
In the code above, Navigate(var) is a function that loads various .XSL files for each category.
Please can anyone help me understand why the error keeps coming up?
Thanks
innerHTMLupdate just once, outside the loop.