Hi. I wanna make a javascript chatroom. it will have two frames. one will hold messages while the other will hold the message box. i will need scripts to make a text file on the fly on the server,update a message form to the text file and delete the file when done. if deleting is not possible the i just need the update the message to the text file or maybe html file for people 2 see. thanks
i made a really primative chat application with HTML frames and javascript, with a PHP text file write action with the text area frame reloading once a second
I do not have the code anymore, I did it in school (i go to a vocational/technical high school in the USA).
However, it amounts to something like this:
frame 1 takes 80% of the page width, and has a javascript like this:
Code:
function refreshPage() {
document.refresh();
//the above may not work, try document.location = document.location; instead?
}
Frame 1 should have a PHP page that reads the file that Frame 2 writes to, and outputs all the text in it.
Frame 1's PHP page should also have a form like this:
<form method="get" action=".\frame1pagename.php"><input type="submit" value="Manual Refresh" /></form>
Frame 2 has 20% of the page width and contains a form to submit to the same page the form is within, that form sends a username and a message to a PHP page which does this:
Code:
//check for file existing
//if file exists, attempt to open
//if open successful, write the validated user input (so no injection) to a new line with <br> at the end
//recreate the form so user can submit another message
//if open fails, report it to the user and do not recreate the <form>
//if file is non-existant, report it to the user and do not recreate the <form>
that is pretty much all there is to it, no need for fancy javascripts at all (except to refresh the page in frame 1, and in the event javascript fails, the button is there that uses standard HTML form to refresh it).
I do not feel like writing all the code at this time. But I hope you can use this outline to help.
Note that you can use the <noscript> element to surround the manual refresh button, so that in the event javascript is turned off or the broswer does not know what either tags are, it still has the form display.
If you look at some alternatives to PHP etc, then you can use java applets to connect to an IRC network you can host with your website, or find an IRC network willing to let you host a chat room, there are plenty for this purpose. This is one of the most common methods of employing a chat room.
IRC is Internet Relay Chat, it uses channels as chatrooms. Channel names begin with # or & usually, # should always work, & is for a chatroom visible only on 1 server, as IRC networks may have more than 1 server that you can connec to.
You just go out, find a java applet such as DarkerIRC (google search jirc as well, if darker doesn't work right). and configure it to connect to an IRC network.
Some popular networks are Freenode, QuakeNet, and UnderNet. I would suggest reading up on IRC and learning it, it is a great communication method. A lot of IRC networks allow you to register your nickname in the chatroom and server so no one else can use it, or they cannot at least register it themselves and not let you use it. The same tends to go for channels, so you have administrative access and people using your website don't complain of being kicked by some person who took over your channel.
Hi. I wanna make a javascript chatroom. it will have two frames. one will hold messages while the other will hold the message box. i will need scripts to make a text file on the fly on the server,update a message form to the text file and delete the file when done. if deleting is not possible the i just need the update the message to the text file or maybe html file for people 2 see. thanks
My names Georgia.I have a brother called josh.I have a step brother called Ben.I have a step sister called Shannon.Do you know any chat room's for any age.
Bookmarks