onload='setInterval(“function()”,1000)' doesn't work

Martinplacemen

New Member
I have an xml file and i want to load its contents into a specific html div every one second, here's the javascript part that parses the xml file:\[code\]function getEntries() { if (window.XMLHttpRequest) req = new XMLHttpRequest(); req.onreadystatechange = handleReq; req.open("GET", "entries.xml", true); req.send(null);}function handleReq() { if (req.readyState == 4) document = req.responseXML; var states = document.getElementsByTagName("entry"); for (i = 0; i < states.length; i++) { currentState = states; document.getElementById("LogArea").innerHTML = "<table><tr><td><b>Name:</b></td><td>" + currentState.getAttribute("umessage"); +"</td></tr><tr><td><b>Message:</b></td><td>" + currentState.getAttribute("uname"); +"</td></tr></table>"; }}\[/code\]and here's the xml file:\[code\]<?xml version="1.0" encoding="UTF-8" standalone="no"?><entries><entry umessage="aaaaaaaa" uname="aaaaaaa" /><entry umessage="Hello everybody" uname="John" /><entry umessage="Hello everybody" uname="Smith" /><entry umessage="Hello everybody" uname="Knuth" /></entries>\[/code\]and that's the html part:\[code\]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><body bgcolor="yellow" onload='setInterval("getEntries()",1000)'><div id="LogArea" align="left"></div></body></html>\[/code\]the problem is that nothing is loaded in the specified div and no errors exists inside firebug
 
Back
Top