Così...
codice:
function handlehHttpReceiveChat() {
currentDest = document.forms['chatForm'].elements['dest'].value;
currentName = document.forms['chatForm'].elements['name'].value;
if (httpReceiveChat.readyState == 4) {
results = httpReceiveChat.responseText.split('---'); //the fields are seperated by ---
if (results.length > 2) {
for(i=0;i < (results.length-1);i=i+3) { //goes through the result one message at a time
insertNewContent(results[i+1],results[i+2]); //inserts the new content into the page
}
lastID = results[results.length-4];
var popup = window.open('http://www.spritzlandia.it/chat.php?dest=' + currentDest,'miaFinestra','');
popup.focus();
}
setTimeout('receiveChatText();',4000); //executes the next data query in 4 seconds
}
}