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

📄 room.html

📁 类QQ聊天其他人不需帐号就可自由下载此源码
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>问答热线</title>
<script language="jscript" type="text/jscript" src="../jscript/Config.js"></script>
<script language="javascript" type="text/javascript">
<!--

var sta = "li_us";
var str;
var content = "";
var user = 0;
var enable = true;
var time = "";
var blsend = false;
var sdtext = "";
var count = 10;
var defer = 0;
var me = "";
function mysend() {
    if(defer > 100)
        alert("您的延迟过高,可能已经掉线。");
    if(sdtext != "")
        sta = "sd_ms";
    switch(sta)
    {
        case "li_us":sendRequest(serverUrl+'/ChatService/users.asmx', 'li_us', 'Post', 'roomid='+QueryString("roomid"), true);
            break;
        case "sel_ms":if(time == "")
	        main.innerHTML = "";
	        sendRequest(serverUrl+'/ChatService/msaccess.asmx', 'sel_ms', 'Post', 'str='+time, true);
            break;
        case "sd_ms":sendRequest(serverUrl+'/ChatService/msaccess.asmx', 'sd_ms', 'Post', sdtext, true);
            break;
        default:break;
    }
}
function recyle() {
	    if(!blsend)
	    {
	        blsend = true;
	        mysend();
	        defer++;
	    }
	    if (req.readyState == 4)
	    {
            xmlResponse();
	        maindiv.doScroll("scrollbarDown");
            defer = 0;
            if(sta = "sd_ms")
               sta = "sel_ms";
            if(count==10)
	        {
	            sta="li_us";
	            count=0;
	        }
	        else
	        {
	            sta="sel_ms";
	        }
            blsend = false;
            count++;
        }  
}
function sel_user(pram1,pram2) {
user = pram1;
list_recent.innerHTML = "<a href=javascript:sel_user('"+pram1+"','"+pram2+"');>"+pram2+"</a><br>"+list_recent.innerHTML;
}
function xmlResponse() {
    if(blsend)
    {
	switch (sta)
	{
		case "li_us":var xml = req.responseXml;
				var nodes = xml.documentElement.getElementsByTagName("User");
				var totle = nodes.length;
				str = "<a href=javascript:sel_user('all','所有人');>所有人("+ (totle) +")</a>";
				for(i=0;i<totle;i++)
				if(i==0)
				    str += "<br><font color=red><b>(我)"+nodes.item(0).childNodes.item(1).text+"</b></font>";
				else
				    str += "<br><img src=../images/Room_user_select.gif width=14 height=14 /><a href=javascript:sel_user('"+nodes.item(i).childNodes.item(0).text+"','"+nodes.item(i).childNodes.item(1).text+"');>"+nodes.item(i).childNodes.item(1).text+"</a>";
				if(totle == 0)
				{
					alert("您已经掉线!");
				}
				list_room.innerHTML = str;
				break;
		case "sel_ms":var xml = req.responseXml;
				var nodes = xml.documentElement.getElementsByTagName("Message");
				var totle = nodes.length-1;
				if(nodes == null)
				{
					alert("您已经掉线!");
				}
				if(totle > 0)
				    time = nodes.item(totle).childNodes.item(8).text.replace("+08:00","");
				content = "";
				for(i=totle-1;i>=0;i--)
				{
				content += "<font color=#C4B3AB><a href=javascript:sel_user('"+nodes.item(i).childNodes.item(4).text+"','"+nodes.item(i).childNodes.item(5).text+"');>"+nodes.item(i).childNodes.item(5).text+"</a>对<a href=javascript:sel_user('"+nodes.item(i).childNodes.item(3).text+"','"+nodes.item(i).childNodes.item(2).text+"');>"+nodes.item(i).childNodes.item(2).text+"</a>";
				if(nodes.item(i).childNodes.item(7).text == "true")
					content += "悄悄地";
				var size = nodes.item(i).childNodes.item(6).text;
				content += "说:</font><font color='"+nodes.item(i).childNodes.item(0).text+"' size='";	
				switch(size)
				{
					case "1":content += "2'>";
						break;
					case "2":content += "2'>";
						break;
					case "3":content += "3'>";
						break;
					case "4":content += "3'>";
						break;
					case "5":content += "4'>";
						break;
					case "6":content += "4'>";
						break;
					default:content += "2'>";
						break;
				}			
				if(size=="2"||size=="4"||size=="6")
					content+="<b>";
				if(nodes.item(i).childNodes.item(9).text == null)
					content += "无语...<br>";
				else
					content += nodes.item(i).childNodes.item(9).text+"</font><br>";
				if(size=="2"||size=="4"||size=="6")
					content+="</b>";
				}
				main.innerHTML += content;
				break;
		case "sd_ms":var xml = req.responseXml;
				if(xml.text != 'true')
				{
					if(xml.text == 'false')
						alert("对方已不在房间里。");
					else
						alert("发送失败");
				}
				else
				{
					enable = false;
					setTimeout(enable_sd,2000);
				}
				sdtext = "";
				break;
		default:break;
	}
	}
}
 //防刷屏的函数,设置可以发送。
function enable_sd() {
	enable = true;
}
function sd_ms() {
	if(trim(text.value) == "")
		alert("对不起,不能发空消息!");
	else if(trim(text.value).length >50)
		alert("对不起,字数限制50以内");
	else if(enable == false)
		alert("对不起,请不要刷屏!(等待2秒...)");
	else if(user == 0)
		alert("对不起,请选择聊天对象");	
	else if(user=='all'&&hiden.checked==true)
		alert("对不起.不能对所有人悄悄话");
	else
	{
		sdtext = 'color='+color.value+'&size='+size.value+'&face=1&text='+escape(text.value)+'&receiver='+user+'&hiden='+hiden.checked;
	    text.value = "";
	}
}
 //检查链接参数roomid,如果为空则请求获取。
function check_rm() {
if(QueryString("roomid") == "")
{
	sta = "";
	sendRequest(serverUrl+'/ChatService/users.asmx', 'sel_usrm', 'Post', '', false);
	if(req.responseXml.childNodes(1).text!="")
	window.location.href=serverUrl+"/Chat/user/Room.html?roomid="+req.responseXml.childNodes(1).text;
}
}
 //退出登陆
function login_out() {
	sta = "login_out";
	sendRequest(serverUrl+'/ChatService/users.asmx', 'login_out', 'Post', null, false);
	window.close();
}
 //去除换行和空格
function key_down() {
if(event.keyCode == 13)
{
	text.value = text.value.replace(/\r\n/ig,'');
	sd_ms();
}
}
 //Name_Set
function Name_Set()
{
    window.open("NameSet.html","NameSet","width=200,height=50,toolbar=no,scrollbars=no,menubar=no,dependent=yes");
}
-->
</script>
<script language="javascript" type="text/javascript" src="../jscript/HttpRequest1.js"></script>
<script language="javascript" type="text/javascript" src="../jscript/HttpQueryString.js"></script>
<link href="../css/Room.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style></head>

<body onload="check_rm();setInterval(recyle,500);">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" colspan="3" background="../images/Room_top_bg.gif" scope="col"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="30%" height="30" align="left" nowrap="nowrap" scope="col"><a href="RoomList.html"><img src="../images/Room_top_home.gif" alt="返回首页" width="56" height="30" border="0" /></a></td>
        <td width="70%" align="right" nowrap="nowrap" scope="col"><img src="../images/Room_top_qq.gif" alt="联系QQ:303864496" width="26" height="30" /><a href="http://dic.cdut.edu.cn" target="_blank"><img src="../images/Room_top_dic.gif" alt="开发单位" width="27" height="30" border="0" /></a><a href="mailto:seawind121@163.com"><img src="../images/Room_top_email.gif" alt="联系我们seawind121@163.com" width="104" height="30" border="0" /></a></td>
      </tr>
    </table></td>
  </tr>
  
  <tr>
    <td width="130" align="left" valign="top" scope="row"><table width="130" border="1" cellpadding="1" cellspacing="0" bordercolor="#0099FF">
      <tr>
        <td height="17" align="center" nowrap="nowrap" background="../images/Room_top_bg.gif" scope="col"><img src="../images/Room_list_separator.gif" width="3" height="17" /><img src="../images/Room_room_list.gif" alt="房间列表" width="55" height="17" border="0" /><img src="../images/Room_list_separator.gif" width="3" height="17" /></td>
      </tr>
      <tr>
        <td><div id="list_roomdiv"><span id="list_room">加载中...</span></div></td>
      </tr>
    </table>
      <table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#0099FF">
        <tr>
          <td width="771" height="24" align="center" background="../images/Room_top_bg.gif" scope="col"><img src="../images/Room_list_recent.gif" alt="最近聊天对象" width="81" height="18" /></td>
        </tr>
        <tr>
          <td height="70"><div id="list_recentdiv"><img src=../images/Room_user_select.gif width=14 height=14 /><span id="list_recent"></span></div></td>
        </tr>
      </table></td>
    <td valign="middle" scope="row"></td>
    <td width="100%" align="left" valign="top" scope="row"><table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#0099FF">
        <tr>
          <td scope="col"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td align="left" background="../images/Room_top_bg.gif" scope="col"><div align="left"><img src="../images/Room_channel_main.gif" width="50" height="17" border="0" /></div></td>
                <td align="left" background="../images/Room_top_bg.gif" scope="col"><div align="right"></div></td>
              </tr>
              <tr>
                <td colspan="2" scope="row"><div id="maindiv"><span id="main">信息加载中...</span></div>                  </td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td scope="row"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" background="../images/Room_top_bg.gif" scope="col"><span>
                <input type="checkbox" name="hiden" value="checkbox" />
                <font color="#0000FF" face="宋体" size="2">私聊</font>
                <select name="size" id="size">
                  <option value="1">小号细</option>
                  <option value="2">小号粗</option>
                  <option value="3">中号细</option>
                  <option value="4">中号粗</option>
                  <option value="5">大号细</option>
                  <option value="6">大号粗</option>
                </select>
                <select name="color" id="color">
                  <option value="black">black</option>
                  <option value="blue">blue</option>
                  <option value="red">red</option>
                  <option value="green">green</option>
                  <option value="yellow">yellow</option>
                  <option value="white">white</option>
                  <option value="orange">orange</option>
                </select>
                  <a href="javascript:Name_Set();"><img src="../images/Name_Set.GIF" border="0" width="51" height="19" /></a></span></td>
            </tr>
            <tr>
              <td align="left" nowrap="nowrap" scope="row"><textarea id="text" onkeyup="key_down();" cols="70" rows="3"></textarea>                <a href="javascript:sd_ms();"><img src="../images/Room_msg_send.gif" alt="发送" width="38" height="38" border="0" /></a></td>
            </tr>
          </table></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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