Ajax Example
<html>
<head>
<Title>Ajax Example</TITLE>
<script type="text/javascript">
var xmlDoc;
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else // Internet Explorer 5/6
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET","http://www.huizelaar.nl/sitemapProvincies.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
var x=xmlDoc.getElementsByTagName("url");
i=0;
function next()
{
if (i<x.length-1)
{
i++;
display();
}
}
function previous()
{
if (i>0)
{
i--;
display();
}
}
function display()
{
loc=(x[i].getElementsByTagName("loc")[0].childNodes[0].nodeValue);
lastMod=(x[i].getElementsByTagName("lastmod")[0].childNodes[0].nodeValue);
changeFreq=(x[i].getElementsByTagName("changefreq")[0].childNodes[0].nodeValue);
document.getElementById("show").innerHTML="Loc: " + loc + "<br />LastMod: " + lastMod + "<br />ChangeFreq: "+ changeFreq;
}
</script>
</head>
<body onload="display()">
<H1>Wat een Ajax Applicatie !</H1>
<div id='show'></div>
<br />
<input type="button" onclick="previous()" value="previous" />
<input type="button" onclick="next()" value="next" />
</body>
</html>
Geen opmerkingen:
Een reactie posten