Hello,
I'm (very) new to wed developping.
I need to write a small html page that reads an XML, and displays properties from the last tag.
The page should refresh every 3 seconds.
I've written this code and it's working fine expect from the refresh part.
I tried replacing "document.writeln" with "alert" and it's working fine.
Please help (my knowledge is quite limited, so please use simple words)
The code:
<html>
<head>
<title>EDX Status</title>
//<META HTTP-EQUIV="refresh" CONTENT="5">
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function readXML()
{
var xmlFile = "somefile.xml";
xmlDoc.async="false";
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
var lastTag = xmlDoc.getElementsByTagName('SomeTag');
document.writeln(lastTag[lastTag.length-1].getAttribute("AttributeOne")+" "+lastTag[lastTag.length-1].getAttribute("AttributeTwo"));
}
function callRead() {
var t=setTimeout("readXML()",3000);
}
</script>
</head>
<body onload="callRead();"">
</body>
</html>


)
Reply With Quote
Bookmarks