<%
' ASPAjax.Path="/aspajax/" ' instalation path 'ASPAjax.Path="/aspajax/"
ASPAjax.Open()
%>
ASP AJAX Chat Application
<%
''''''''''''''''''''''''''''''''''SETUP CHAT''''''''''''''''''''''''''''''''''
Dim ChatArray, i
ChatArray = Application.Contents("ASPAJAX_ChatArray")
If not isArray(ChatArray) Then
ChatArray=Array("","","","","","","","","","")
End If
''''''''''''''''''''''''''''''''''PROCESS CHAT INPUT''''''''''''''''''''''''''''''''''
If Request.Form("SubmitChat")<>"" Then
For i = 0 to UBound(ChatArray)-1
ChatArray(i) = ChatArray(i+1)
Next
ChatArray(UBound(ChatArray)) = ""&time()&" "&Request.ServerVariables("REMOTE_HOST")&" : "&Request.Form("usrName") &" : "& Request.Form("usrMsg") & " "
Application.Contents("ASPAJAX_ChatArray") = ChatArray
End If
''''''''''''''''''''''''''''''''''PROCESS CHAT INPUT''''''''''''''''''''''''''''''''''
%>
Chat Window:
<%
Dim myPanel
Set myPanel = ASPAjax.CreateUpdatePanel
myPanel.Id = "CHAT"
myPanel.RefreshInterval = 5 ' UpdatePanel self refreshes every 5 seconds
Call myPanel.RegisterTrigger ("form1" , "onsubmit") ' Makes form1 use AJAX to refresh this UpdatePanel
myPanel.Open
%>
<%''''''''''''''''''''''''''''''''''DRAW CHAT OUTPUT''''''''''''''''''''''''''''''''''%>
<%=Join(ChatArray,"")%>
Last Checked: <%=time()%>
<%
myPanel.close
set myPanel = nothing
%>
This chat application has been kept simple - so that it can be easily modified and skinned.