Technical implementation of no-refreshing chat rooms

Source: Internet
Author: User
Let's briefly describe
Use a program to generate the required XML file
Use XMLHTTP or DSO (note status) to regularly refresh required data
It is relatively easy for DSO to map to recordset.
The following is a simple and simple example of what I wrote to play.
Only code snippets, but it is sufficient for technical reference.
MSXML 4.0 is required
On the server side, I wrote two constructors: Chat content chat users.
<Script language = "JScript" runat = "server">
Function SLIGHTBOYChat ()
This. ID;
This. XMLDOMElement = Server. CreateObject ("Msxml2.FreeThreadedDOMDocument. 4.0 ")
This. Add = function (Name, Content, Append)
Var root = this.XMLDOMElement.doc umentElement;
Var newItem = this. XMLDOMElement. createElement ("Item ");
Var newItemName = this. XMLDOMElement. createElement ("Name ");
Var newItemNameValue = this. XMLDOMElement. createCDATASection (Name );
NewItemName. appendChild (newItemNameValue)
Var newItemContent = this. XMLDOMElement. createElement ("Content ");
Var newItemContentValue = this. XMLDOMElement. createCDATASection (Content );
NewItemContent. appendChild (newItemContentValue)
Var newItemAppend = this. XMLDOMElement. createElement ("Append ");
NewItemAppend. text = Append;
NewItem. appendChild (newItemName );
NewItem. appendChild (newItemContent );
NewItem. appendChild (newItemAppend );
If (root. childNodes. length> 10)
Root. removeChild (root. firstChild)
Root. appendChild (newItem)
This. Save = function ()
Application ("ChatContent") = this. XMLDOMElement. xml;
This. GUID = function (PushGUID)
If (PushGUID. Count> 0)
This. ID = PushGUID;
This. ID = "";
This. Xml = function ()
If (this. ID! = "")
Var XMLDOMElementString = "<? Xml version = "1.0" encoding = "gb2312"?> <Chat> ";
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.