I could use a little help defining the method of getting a tag name when the tag name contains an obscure character.
artist=(x[i].getElementsByTagName("content:encoded")[0].childNodes[0].nodeValue);
I tried and failed with:
artist=(x[i].getElementsByTagName("content" + : + "encoded")[0].childNodes[0].nodeValue);
The full js currently here. i want to also get the contents of the <content:encoded> tag that is also present in every item.
$(document).ready(function() {
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","http://doobox.co.uk/rss/page1/files/blog.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
x=xmlDoc.getElementsByTagName("item");
i=0;
$(document).ready(function() {
displayItem()
});
function displayItem()
{
artist=(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
title=(x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue);
year=(x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue);
txt="Artist: " + artist + "<br />Title: " + title + "<br />Year: "+ year;
document.getElementById("ShowLatestBlog").innerHTML=txt;
}
$('.back').click(function() {
if (i<x.length-1)
{
i++;
displayItem();
}
});
$('.forward').click(function() {
if (i>0)
{
i--;
displayItem();
}
});
});