PDA

View Full Version : simple chat



lelu
01-14-2007, 04:23 PM
Script Title: chat

Sample of chat
http://johansyl.aroundtheglobe.nl/gastenboek/

Describe problem:

Please,help.
I need a script for this kind of chat you can find in website link above.
The user can tipe name and message, click "submite"button and
the message will appear on the sepparate frame from others.

yoshi555
01-14-2007, 04:57 PM
you mean like wat they have here cause Iv been tring to figure out here but if you just want one and not no the code a website gives you an Iframe from theres if you want if you do just say and ill go get it

lelu
01-14-2007, 05:29 PM
Thank you very much for reply!
I am trying create my own website with my chat and when I saw the one from the link "aroundtheglobe"...that exactly what I was searching!
If it is possible to create script for same one?

Thank you.

yoshi555
01-14-2007, 05:45 PM
does that mean you want the iframe or not

lelu
01-14-2007, 10:20 PM
what do you mean by "inframe"?

mburt
01-14-2007, 10:24 PM
you mean like wat they have here cause Iv been tring to figure out here but if you just want one and not no the code a website gives you an Iframe from theres if you want if you do just say and ill go get it

The longest run-on sentence ever...
Anyways, hotscripts.com for a php script for a simple chat. There is many available.

Twey
01-14-2007, 10:37 PM
There's one I did for johnnymushio floating about the forums somewhere. You could just change the theme on that.

mburt
01-14-2007, 10:41 PM
Hmm... no matches for "johnnymushio" or "chat".

lelu
01-14-2007, 10:43 PM
Yepp, I did find it :-)
I'll try to figure it out.
Thank you.

Twey
01-14-2007, 10:58 PM
http://www.twey.co.uk/files/chat.phps

lelu
01-15-2007, 08:02 PM
- 2 text boxs
-one for the username
-one for the user message
-verytime a user sends a message it clears both the username
and message box

I am getting a ot of ERRORS




<html>
<head>

<applet>
codebase="http://client4.addonchat.com/current/"
code="Client.class" archive="scclient_en.zip"
alt="AddonChat Java Chat Software"
width=600 height=400 MAYSCRIPT>
<param name="room" value="176356">
</applet>

<script type="text/javascript">
/* Writing Ajax Requests */
var http_request=false;
var http_request2=false;
var intUpdate;function ajax_request(url){http_request=false;
if(window.XMLHttpRequest){http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}}
else if(window.ActiveXObject){

try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}
if(!http_request){alert();return false;}
http_request.onreadystatechange=alertContents;http_request.open('GET',url,true);http_request.send(null);}

function alertContents(){
if(http_request.readyState==4){
if(http_request.status==200){rec_response(http_request.responseText);}else{}}}

/* Reading Ajax Requests */
function ajax_request2(url){http_request2=false;
if(window.XMLHttpRequest){http_request2=new XMLHttpRequest();
if(http_request2.overrideMimeType){http_request2.overrideMimeType('text/xml');}}
else if(window.ActiveXObject){try{http_request2=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{http_request2=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}
if(!http_request2){alert();
return false;}
http_request2.onreadystatechange=alertContents2;http_request2.open('GET',url,true);http_request2.send(null);}

function alertContents2(){
if(http_request2.readyState==4){
if(http_request2.status==200){rec_chatcontent(http_request2.responseText);}
else{}}}

/* Chat Stuff */
waittime=2000;
intUpdate=window.setTimeout("read_cont()", waittime);
chatwindow.value = "connecting...";

function display_msg(msg1) {
/* Fill Textarea with the Content */
document.getElementById("chatdiv").innerHTML=msg1 ;
}
function write_msg(msg1) {
ajax_request("w.php?m=" + escape(msg1));
}

function submit_msg() {
/* Send My Message */
write_msg(chatname.value + chatnms.value + chatmsg.value);
chatname.value="";
chatnms.value=": ";
chatmsg.value="";
}

function rec_response(str1) {
/* Response From w.php */
}

function rec_chatcontent(cont1) {
if (cont1 != "") {
out1 = "";
/* Display Last Message First */
while (cont1.indexOf("\n") > -1) {
out1 = cont1.substr(0, cont1.indexOf("\n")) + "\n" + out1;
cont1 = cont1.substr(cont1.indexOf("\n") + 1);
}
out1 = unescape(out1);
if (chatwindow.value != out1) { display_msg(out1); }
intUpdate=window.setTimeout("read_cont()", waittime);
}
}

function read_cont() {
/* Prevent Buffering by using ?x=timeinms */
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
ajax_request2("chat.txt?x=" + ms);
}
function keyup(arg1) { if (arg1 == 13) { submit_msg(); } }
</script>
</head>



<body>

<textarea id="chatwindow" rows="10" cols="80" style="border:1px solid #aaaaaa; padding:4px;" readonly></textarea><br>
<input id="chatname" type="text" size="20" style="border:1px solid #aaaaaa;">
<input id="chatnms" type="hidden" value=": ">
<input id="chatmsg" type="text" size="20" style="border:1px solid #aaaaaa;"
onkeyup="keyup(event.keyCode);">
<input type="button" value="ok" onclick="submit_msg()" style="cursor:pointer;border:1px solid gray;">
</body>
</html>