קוד:
<html>
<head>
<script type="text/javascript" src="js.js"></script>
</head>
<body>
<script type="text/javascript">
xmlDoc=loadXMLDoc("books.xml");
document.write(xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue + "<br />");
document.write(xmlDoc.getElementsByTagName("author")[0].childNodes[0].nodeValue + "<br />");
document.write(xmlDoc.getElementsByTagName("year")[0].childNodes[0].nodeValue);
</script>
</body>
</html>
קוד:
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
}
איך אני מוסיף לזה רענון אוטומטי שזה יציג תוכן עדכני מה xml שלי
אני ידוע שמשתמשים ב setInterval או setTimeout אבל זה לא מצליח לי...