I have a blog i am creating from scratch. I have the html page i want to publish the blog to, the javascript file that is going to be publishing the blog, and the xml file that contains the blog posts. I have looked at all of the information on the w3schools website and i cannot find what is wrong with the script. The script has a function named Blog() in it that i want activated by a button. Here is my code that i have.
Here is the html code i have.
[CODE]
<div id="blog">
<script type="text/javascript" scr="blog.js"></script>
<button type="button" onclick="Blog()">click me</button>
</div>
[CODE]
Here is the code from blog.js
[CODE]
function Blog()
{
var XHR;
if(window.XMLHttpRequest)
{
XHR = new XMLHttpRequest();
}
else
{
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
XHR.onReadyStateChange = function()
{
if(XHR.readyState == 4 && XHR.status == 200)
{
var xmldom = XHR.responseXML;
var output = "";
var items = xmldom.getElementsByTagName("item");
for(var i = 0;i < items.length;i++)
{
output = xmldom;
}
document.getElementById("blog").innerHTML = output;
}
}
XHR.open("GET", "blog.xml", true);
XHR.send();
}
[CODE]
Here is the code from the blog.xml file.
[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<item>
<title>hello</title>
<link>www.google.com</link>
<description>world</description>
</item>
<item>
<title>hello</title>
<link>www.google.com</link>
<description>world</description>
</item>
<item>
<title>hello</title>
<link>www.google.com</link>
<description>world</description>
</item>
<title>
Unified Feed
</title>
<category>
Business
</category>
<language>
US-en
</language>
<ttl>
60
</ttl>
</channel>
</rss>
[CODE]
Would love some help with this

.