lo hago yo a pelo:
http://zital.no-ip.org/txat/js/ajax.js Código PHP:
var messages=ajax.responseXML;
messages=messages.getElementsByTagName('ms');
messages=messages.item(0);
var message=messages.getElementsByTagName('m');
for(var i=0;i<message.length;i++)
{
var id=message[i].getElementsByTagName('id');
id=id.item(0);
id=id.firstChild.nodeValue;
if(in_array(id,tmpCommentsId)==true) // if repeated ID in the same ajax response break
{
break;
}
var date=message[i].getElementsByTagName('date');
date=date.item(0).firstChild.nodeValue;
var name=message[i].getElementsByTagName('name');
name=name.item(0).firstChild.nodeValue;
var comment=message[i].getElementsByTagName('comment');
comment=comment.item(0).firstChild.nodeValue;
var span=document.createElement('span'); // create span element
span.id="span"+id; // set ID to the span
var strong=document.createElement('strong');
var txt=document.createTextNode(date+" - "+name+": ");
var txt2=document.createTextNode(comment);
var br=document.createElement('br');
strong.appendChild(txt);
span.appendChild(strong);
span.appendChild(txt2);
span.appendChild(br);
chat.appendChild(span); // insert span into chat
}