⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view.aspx

📁 设计中的通讯系统是用asp.net技术实现的基于web的聊天室系统。聊天室是Web服务中最常见的服务
💻 ASPX
字号:
<Script Language="VB" Runat="Server">
 Sub page_load(Sender As Object,e As Eventargs)
   Dim txt,i
   Response.Write("<META HTTP-EQUIV=REFRESH CONTENT=2.5>" & vbcRlf)
   Response.Write("<Script language='VbScript'>" & vbcRlf)
   Response.Write("Sub view()" & vbcRlf)
   Response.Write("Dim txt,count" & vbcRlf)
   Response.Write("count=content.public.length-1 " & vbcRlf)
   Response.Write("For i=0 to count" & vbcRlf)
   Response.Write("txt=txt & content.public.item(i).text & vbcRlf" & vbcRlf)
   Response.Write("next" & vbcRlf)
   Response.Write("parent.body1.content.public.innerText=txt" & vbcRlf)
   Response.Write("count=content.private.length-1" & vbcRlf)
   Response.Write("txt=" & chr(34) & chr(34) & vbcRlf)
   Response.Write("For i=0 to count" & vbcRlf)
   Response.Write("txt=txt & content.private.item(i).text & vbcrlf" & vbcRlf)
   Response.Write("next" & vbcRlf)
   Response.Write("parent.body1.content.private.innertext=txt" & vbcRlf)
   Response.Write("End Sub" & vbcRlf)
   Response.Write("<" & "/Script>" & vbcRlf)
   Response.Write("<Html>" & vbcRlf)
   Response.Write("<Body onload=view>" & vbcRlf)
   Response.Write("<Form name=content>" & vbcRlf)
   Response.Write("<Select name=public rows=40 >" & vbcRlf)
   Application.Lock
   For i=Application("Current") to 19
      txt=Application("chats")(i)
      Response.Write("<Option>" & txt &"</Option>")
   Next
   For i=0 to Application("Current")-1
      txt=Application("chats")(i)
      Response.Write("<Option>" & txt &"</Option>")
   Next       
   Response.Write("</Select>")
   txt=""
   Response.Write("<Select name=private rows=40 >")
    For i=Application("chatnum") to 39
       '检查是否有私聊内容
       If Application("Owner")(i)=session("user") then
          txt=Application("chattime")(i) & "您悄悄的对" & Application("Sendto")(i) & "说: " & Application("chat")(i)
       ElseIf Application("Sendto")(i)=Session("User") Then
          txt=Application("chattime")(i)& Application("Owner")(i) & "悄悄的对您说: " & Application("chat")(i)
       End If
       Response.Write("<Option>" & txt &"</Option>")
       txt=""
    Next
    For i=0 to Application("chatnum")-1
       '检查是否有私聊内容
      If Application("Owner")(i)=session("user") then
          txt=Application("chattime")(i) & "您悄悄的对" & Application("Sendto")(i) & "说: " & Application("chat")(i)
      ElseIf Application("Sendto")(i)=Session("User") Then
          txt=Application("chattime")(i) & Application("Owner")(i) & "悄悄的对您说: " & Application("chat")(i)
      End If
      Response.Write("<Option>" & txt &"</Option>")
       txt=""
    Next
   '首先将更新当前用户的最后访问事件
     '等到该用户的索引值
   Dim Count As integer
   Dim user As string
   count=Array.IndexOf(Application("user"),session("user"))
   Application("last")(count)=now
   '检测用户是否离线
   For i=0 to Application("userNum")-1
    If DateDiff(DateInterval.Second,Application("last")(i),now)>120 Then
      '当前用户离线处理
          '将用户列表和访问时间重新排列
          Dim j As Integer
          user=Application("user")(i)
          For j=i to Application("UserNum")-1
              Application("user")(i)=Application("user")(i+1)
              Application("last")(i)=Application("last")(i+1)
          Next 
          Application("Usernum")-=1
          '向信息中心发送信息
         If Application("Current")>=20 then
            Count=0
            Application("Current")=0
         Else
            count=Application("Current")
         End If
         Application("Chats")(count)=now & user & "断线!"
         Application("Current")+=1             
    End If
   Next
   Application.UnLock
   Response.Write("</Select>")
   Response.Write("</Form>")
   Response.Write("</body>")
   Response.Write("</Html>")
 End Sub
</Script>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -