This is the command center of the chat room. all commands must be sent here. 1. below is the basic sending form code lt; formnameinputformactionmessagesend. phptargetblonsubmitreturn (checksay (); methodPOSTgt; lt ;? // The following two parameters are used to verify the correctness of the information. print (lt; in is the command center of the chat room. all commands must be issued here.
1. The following is the basic sending form code.
2. check the js of the sent content
Var dx = '';
Function checksay ()
{
// Do not send blank speeches
If (document. inputform. msg. value = '')
{
Document. inputform. msg. focus ();
Return false;
}
// Repeated speeches are not allowed. the content is the same and the objects are the same.
If (document. inputform. msg. value = document. inputform. message. value) & (document. inputform. talkto. value = dx ))
{
Alert ('statement cannot be repeated ');
Document. inputform. msg. focus ();
Return false;
}
// The interval between two speeches cannot be less than 1 second, or the interval between the two speeches * 3
T2 = (new Date (). getTime ()/1000;
If (T2-T1) <1) | (T2-T1) * 3 {
Document. inputform. msg. focus ();
Return false;
}
// Update time
T1 = t2;
Document. inputform. showsign. value = 1;
// Save the content of the previous speech
Document. inputform. message. value = document. inputform. msg. value;
// Clear the speech content
Document. inputform. msg. value = '';
// Save the speaker
Dx = document. inputform. talkto. value;
// Locate the focus
Document. inputform. msg. focus ();
// Return
Return (true );
}
3. call the information Sender program to publish information that the chatbot has entered.
Script
Parent.bl.doc ument. open ();
Parent.bl.doc ument. write (" ")
Parent.bl.doc ument. close ();
Script
The speech is processed by messagesend. php. Note that the output object is bl, that is, the name of the framework for processing the speech. This ensures that the content on the page of the speech framework is complete.
Original Author: howtodo
Source: php2000.com