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

📄 default.aspx

📁 计算机实验课在线答疑系统 09年毕业设计
💻 ASPX
字号:
<%@ Page language="C#" Inherits="book09.ChatRoom" codePage="936" CodeFile="Default.aspx.cs" %>
<%@ Register Src="~/WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
 <title>实验室</title>
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">



<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
  <script language="javascript">
  //发送消息
  function send()
  {
   var txtContent = document.all("content").value; //文本框输入内容  
  //
  //
  //
 // 
   if (txtContent == "") return;
   
   var user_to = document.all("userlist").value;  //聊天对象
   var textcolor = document.all("textcolor").value;  //颜色
   var expression = document.all("expression").value;  //表情
   var isPublic = !(document.all("isSecret").checked);  //是否密谈    
   
   //调用服务器端方法发送消息
   ChatRoom.SendMsg(txtContent, user_to, textcolor, expression, isPublic);
   
   //更新聊天内容显示
   var div = document.all("chatcontent");
   div.innerHTML = ChatRoom.GetNewMsgString().value + div.innerHTML;
   
   //清空输入框
   document.all("content").value = "";
  }
  
  //定时更新聊天内容
  function refresh_chatcontent()
  {
   //调用服务器方法获取最新消息的HTML字符串
   var div = document.all("chatcontent");
   var strNewMsg = ChatRoom.GetNewMsgString().value;
   
   //判断是否为空,避免不必要的更新
   if (strNewMsg != "")
    div.innerHTML = strNewMsg + div.innerHTML;
    
   //定时更新
   window.setTimeout(refresh_chatcontent, 1000);
  }
  
  //更新用户列表(左侧和下拉列表)
  function refresh_onlineusers()
  {
   //发送对象列表
   var userlist = document.all("userlist");
   
   //调用服务器端方法获取用户列表字符串(用逗号分隔)
   var strUserlist = ChatRoom.GetOnlineUserString().value;
   
   //获取客户端显示的用户列表字符串
   var strUserlistClient = "";
   for (var i = 1;i < userlist.options.length;i++)
   {
    if (i != userlist.options.length - 1)
    {
     strUserlistClient += userlist.options[i].value + ",";
    }
    else
    {
     strUserlistClient += userlist.options[i].value;
    }
   }
   
   if (strUserlistClient != strUserlist)  //在线用户列表发生变化
   {
    var userArr = strUserlist.split(',');
    
    //在线用户数
    var usercount = document.all("usercount");
    usercount.innerHTML = "在线名单:<br />(" + userArr.length + "人)";
    
    //左边用户列表
    var tableHTML = "<table>";
    for (var i = 0;i < userArr.length;i++)
    {
     tableHTML += "<tr><td><label onmouseover=\"this.style.cursor='hand'\" onmouseout=\"this.style.cursor='default'\" onclick=\"setObj('" + userArr[i] + "')\">" + userArr[i] + "</label></td></tr>";
    }
    tableHTML += "</table>";
    var div = document.all("onlineusers");
    div.innerHTML = tableHTML;
    
    
    //初始化
    while (userlist.options.length > 0)
    {
     userlist.removeChild(userlist.options[0]);  //清空所有选项
    }
    
    //增加“所有的人”选项
    var oOption = document.createElement("OPTION");
    oOption.text = "所有的人";
    oOption.value = "大家";
    userlist.add(oOption);
    
    //下拉列表中增加在线用户的选项
    for (var i = 0;i < userArr.length;i++)
    {
     var oOption = document.createElement("OPTION");
     oOption.text = userArr[i];
     oOption.value = userArr[i];
     userlist.add(oOption);
    }     
   }   
   
   //每隔1秒更新
   window.setTimeout(refresh_onlineusers, 1000);
  }
  
  //退出聊天室
  function logout()
  {
   ChatRoom.Logout();
  } 
  
  //设置聊天对象
  function setObj(str)
  {
   var userlist = document.all("userlist");
   for (var i = 0;i < userlist.options.length;i++)
   {
    if (str == userlist.options[i].value)
    {
     userlist.selectedIndex = i;
     break;      
    }
   }
  }
  
  //关闭浏览器窗口
  function Close()
  { 
   var ua = navigator.userAgent;
   var ie = navigator.appName == "Microsoft Internet Explorer" ? true:false;
   if (ie) 
   { 
    var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))));
    if (IEversion< 5.5) 
    { 
      var str  = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'; 
      str += '<param name="Command" value="Close"></object>'; 
      document.body.insertAdjacentHTML("beforeEnd", str); 
      document.all.noTipClose.Click();
    } 
    else 
    { 
     window.opener = null; 
     window.close(); 
    }
   } 
   else 
   { 
    window.close();
   } 
  }

  </script>
<style type="text/css">
<!--
@import url("css/home_ge.css");
@import url("css/home_ly.css");
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url(images/bg.jpg);
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #333333;
}
a:hover {
	text-decoration: underline;
	color: #FF0000;
}
a:active {
	text-decoration: none;
}
.STYLE8 {
	font-size: 12px;
	color: #333333;
}
.STYLE9 {font-size: 12px}
-->
</style>
</head>
<body  bottomMargin="0" onbeforeunload="logout()" leftMargin="0" topMargin="0" rightMargin="0" bgcolor="LightGrey" link="Black"><!---->
  <form id="Form1" method="post" runat="server">
<table border="1" align="center" style="width: 808px; height: 501px">
          <tr align="center">
              <td colspan="3">
                  <uc1:WebUserControl ID="WebUserControl2" runat="server" /></td>
          </tr>
          <tr>
              <td style="width: 70px; height: 18px;">
                  <label onMouseOver="this.style.cursor='hand'" onMouseOut="this.style.cursor='default'" onClick="document.all('chatcontent').innerHTML = ''" style="FONT-SIZE:14px; COLOR: #ffcc00; TEXT-ALIGN: center"><span class="STYLE8">清空屏幕</span></label></td>
              <td style="width: 259px; height: 18px;">
                    <label onMouseOver="this.style.cursor='hand'" onMouseOut="this.style.cursor='default'" onClick="if (confirm('您确定要退出该聊天室吗?')) Close();" style="FONT-SIZE:14px; COLOR: #ffcc00; TEXT-ALIGN: center"><span class="STYLE8">退出聊天</span></label></td>
              <td rowspan="5" style="width: 73px" valign="top">
            <div id="usercount"></div>
      <div id="onlineusers">
          </div></td>
          </tr>
          <tr>
              <td colspan="2" style="height: 215px"><div id="chatcontent" style=" left: 1px; top: 0px; width: 100%; position: relative; height: 100%; background-color: #ffffff; z-index: -2;" ></div></td>
          </tr>
          <tr>
              <td colspan="2">
                  颜色<span style="FONT-SIZE: 13px">
           <select style="FONT-SIZE: 12px" name="textcolor">
             <option style="COLOR: #000000" value="000000" selected> 绝对黑色
               <option style="COLOR: #000080" value="000080"> 忧郁的蓝
                <option style="COLOR: #0000ff" value="0000ff"> 碧空蓝天
             
                <option style="COLOR: #ff8080" value="ff8080"> 红旗飘飘
                <option style="COLOR: #ff8000" value="ff8000"> 黄金岁月
                <option style="COLOR: #ff80ff" value="ff80ff"> 紫金绣贴
                <option style="COLOR: #008000" value="008000"> 橄榄树绿
                <option style="COLOR: #345678" value="345678">我不知道</option>
           </select>
         表情
         <select style="FONT-SIZE: 12px" name="expression">
           <option value="" selected> 请选择
             <option value="笑着"> 笑着
               <option value="高兴地"> 高兴地
                <option value="含情脉脉"> 含情脉脉
                <option value="微笑"> 微笑
                <option value="幸福"> 幸福
                <option value="有点脸红"> 有点脸红
                <option value="使劲安慰"> 使劲安慰
                <option value="自言自语"> 自言自语
                <option value="差点要哭"> 差点要哭
                <option value="嚎啕大哭"> 嚎啕大哭
                <option value="一把鼻涕"> 一把鼻涕
                <option value="很无辜"> 很无辜
                <option value="流口水"> 流口水
            
                <option value="不好意思"> 不好意思
                <option value="高兴地唱"> 高兴地唱
                <option value="轻轻地唱"> 轻轻地唱
                <option value="很诧异"> 很诧异
                <option value="依依不舍">依依不舍</option>
         </select>
         聊天对象
         <SELECT style="FONT-SIZE: 12px" name="userlist">
           <OPTION value="大家" selected>所有的人</OPTION>
         </SELECT>
         <INPUT id="Checkbox1" type="checkbox" name="isSecret">
         密谈</span></td>
          </tr>
          <tr>
              <td colspan="2"><textarea id="content" onKeyDown="if (event.keyCode == 13) {send();return false;}"  name="content" style="width: 641px; height: 64px" wrap=""></textarea></td>
          </tr>
          <tr>
              <td style="width: 70px; height: 30px;">
                  <input id="Button1" onClick="send();return false;" type="button" value="发送" name="btnSend" /></td>
              <td style="width: 259px; height: 30px;">
                  <input id="Button2" onClick="document.all('content').innerHTML = ''" type="button" value="重填" name="btnSend2" />
                  </td>
          </tr>
      
</table>
 <div align="center">
     <br />
     <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/chpwd.aspx" Width="68px">修改密码</asp:HyperLink>--<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/admin/admin.aspx" Enabled="False" ToolTip="用admin身份才能登录" >进入后台管理</asp:HyperLink>

     <script language="javascript">
   refresh_chatcontent();
   HyperLink1
   refresh_onlineusers();
   </script>

    
     <br />
     <hr color="#cccccc" />
 </div>
  <div  align=center><a href="http://www.gdpu.cn" target="_blank">廣東藥學院</a>
    醫藥信息工程學院 計算機科學與技術(藥品電子商務方向)05 黄志春 0507504118</div>
    </form>
</body>
</html>

⌨️ 快捷键说明

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