Forum Moderators: open

Message Too Old, No Replies

Help with my chat room

         

MrGecko

7:45 pm on Aug 15, 2007 (gmt 0)

10+ Year Member


i can't find the problem in this code but there is a problem

var ids = new Array();
var newchat = document.createElement("div"[smilestopper]);
var chat = document.getElementById("chat"[smilestopper]);
if (window.XMLHttpRequest) {
get = new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
get = new ActiveXObject("XMLHTTP"[smilestopper]);
}
get.onreadystatechange = function() {
var newchattext = get.responseText.split("\n"[smilestopper]);
newchat.style.backgroundColor = "#FFFFFF";
newchat.style.color = "#000000";
for(i=0; i<newchattext.length-1; i++) {
var newtext = newchattext[i].split("¦ID¦"[smilestopper]);
newchat.innerHTML += newtext[1] + "<br>";
ids[i] = newtext[0];
}
chat.appendChild(newchat);
chat.scrollTop = chat.scrollHeight
};
get.open("GET", "chat.txt", true);
get.send(null);

the chat.txt has
15071208255953423121709¦ID¦<font color="#777777">12:17.09PM</font> James: hi
15071208255953423127709¦ID¦<font color="#777777">12:17.19PM</font> James: <font size="20">test</font>

in it
and the script out puts
<font color="#777777">12:17.09PM</font> James: hi<br>
<font color="#777777">12:17.19PM</font> James: <font size="20">test</font><br>
<font color="#777777">12:17.09PM</font> James: hi<br>
<font color="#777777">12:17.19PM</font> James: <font size="20">test</font><br>
why dose it display the text file 2 times
i can't see the problem
please help

MrGecko

8:39 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



I fixed it finaly