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

📄 allusers.htm

📁 这是基于网络编程的
💻 HTM
字号:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv=refresh content=150><!--多少秒钟后刷新本页-->
<TITLE>MeChat聊友查询</TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function ChatRoom()
{
	this.RoomID		;       //房间RoomID
	this.RoomName		;	// 房间名称
	this.URL		;	// 登录地址
	this.UserCount	;	// 在线人数
	this.MaxOnline	;	// 最高在线
	this.State		;	// 满员状态	0=正常 1=热闹 -1=满员禁止登录
	this.Topic		;	// 当前话题
	this.AdminNames ;	// 管理员名单
	this.RoomArea=0;	//  地区	
	this.RoomType	;	// 房间分类ID
	this.Private = 0 ; // 是否自建  1:是,0:否
	this.Locked = 0 ;  // 是否加锁  1:是,0:否
	this.SupportAudio=0;// 是否支持语音  1:是,0:否
	this.SupportVideo=0;// 是否支持视频  1:是,0:否	
	this.RoomDisplay=1;
	this.Other=0;		
	this.Reserve="";
	this.UserList = new UserGroup();	
}

function ChatServer()
{
	this.MaxOnline = 0 ;	// 最高在线
	this.RegUsers = 0 ;		// 总注册人数
	this.TotalUsers = 0 ;	// 当前在线人数
	
	this.m_pChatRoom	= new Array();
	this.RoomsCount = function(){return this.m_pChatRoom.length;}	// 房间数
	this.GetRoomObject = function(n) // 取得房间对象
	{	if(n < this.RoomsCount()) return this.m_pChatRoom[n];
		return null;
	}
	this.SortRule= function(a, b)
	{	var n1 = a.UserCount ;
		var n2 = b.UserCount ;
		if(n1 == n2)	return 0 ;
		if(n1 > n2)		return -1 ;
		if(n1 < n2)		return 1;
	}
	this.Sort= function(){this.m_pChatRoom.sort(this.SortRule);}
	this.Add = function(nRoomID,strRoomName, strURL, nUserCount, nMax, nState, strTopic, strAdmins, nRoomArea,nRoomType, bPrivate, bLocked,nSupportAudio,nSupportVideo,nRoomDisplay,nOther,strReserve)
	{
		var obj = new ChatRoom() ;
		obj.RoomID		= nRoomID ;	// 房间名称
		obj.RoomName		= strRoomName ;	// 房间名称
		obj.URL			= strURL;		// 登录地址
		obj.UserCount	= nUserCount ;	// 在线人数
		obj.MaxOnline	= nMax ;		// 最高在线
		obj.State		= nState ;		// 满员状态	0=正常 1=超员 -1=满员禁止登录
		obj.Topic		= strTopic ;	// 当前话题
		obj.AdminNames	= strAdmins ;	// 管理员名单
		obj.RoomArea = nRoomArea;		
		obj.RoomType	= nRoomType ;	// 房间分类ID
		obj.Private		= bPrivate ;	// 是否自建
		obj.Locked		= bLocked ;		// 是否加锁
		obj.SupportAudio = nSupportAudio;
		obj.SupportVideo = nSupportVideo;
		obj.RoomDisplay = nRoomDisplay;
		obj.Other = nOther;	
		obj.Reserve = strReserve		
		this.m_pChatRoom[this.RoomsCount()] = obj ;
	}
	
	this.SetCount = function(nMax, nReg, nTotal)
	{	this.MaxOnline	= nMax ;
		this.RegUsers	= nReg ;
		this.TotalUsers = nTotal ;
	}
	this.GetUserList = function(n){return this.m_pChatRoom[n].UserList;}	
} 

function ChatUser()
{	this.UserName ;		// 用户名
	this.Alias ;		// 昵称
	this.Sex ;			// 性别
	this.Status ;		// 在线状态
	this.LoginTime ;	// 登录时间
}
function UserGroup()
{
	this.m_pUsers = new Array() ;
	
	this.GetCount = function(){return this.m_pUsers.length;}
	this.GetUserObject= function(n){return this.m_pUsers[n];}
	this.Add = function(strName, strAlias, nSex, nStatus, strTime)
	{	var obj = new ChatUser() ;
		obj.UserName = strName ;
		obj.Alias = strAlias ;
		obj.Sex		 = nSex ;
		obj.Status	 = nStatus ;
		obj.LoginTime = strTime ;
		this.m_pUsers[this.GetCount()] = obj ;
	}
	this.SortRule = function(a, b)
	{	var n1 = a.Sex ;
		var n2 = b.Sex ;
		if(n1 == n2)	return 0 ;
		if(n1 > n2)		return 1 ;
		if(n1 < n2)		return -1;
	}
	this.Sort = function(){this.m_pUsers.sort(this.SortRule);}
	this.Find = function(strUser)
	{
		for(var i = 0; i < this.GetCount() ; i ++)
		{
			var obj = this.GetUserObject(i) ;
			if(obj.UserName == strUser || obj.Alias == strUser)
				return true ;
		}
		return false;
	}
}


function FindUser(n,strName) // 查找指定的用户
{
	pos = GetUsersPos(n) ; 	
	nUsers = GetUsersNum(n) ;
	if(nUsers > 0)
	{	
		for(var j=pos; j < pos+nUsers*3; j+=3)
		{
			if(strName == AllUsers[j+0] || strName == AllUsers[j+1])
				return true;
		}
	}
	return false;
}
function OnLogin(n) // 登录聊天室
{	window.open(GetRoomURL(n)+"Login","MeChatMain","toolbar=no,location=no,directories=no,menubar=no,resizable=yes");
}
var Server = new ChatServer() ;
var obj ;
<!--$AllUserList-->
/*脚本定义完毕*/
//-->
</SCRIPT>
<style type="text/css">
<!--修改性别颜色值请修改本页的CSS属性定义
body {  font-size: 11pt}
table {  font-size: 10.5pt}
a {  text-decoration: none}
a:visited {  color: #0000FF; text-decoration: none}
a:hover {  color: #FF0033; text-decoration: none}
.boy { color: 0000FF}
.girl { color: FF80FF}
.private { color: green}
-->
</style>

<meta name="keywords" content="语音聊天">
<meta name="keywords" content="语音视频聊天">
<meta name="keywords" content="视频聊天">
</HEAD>
<BODY bgcolor="#eeeeff" Language="JavaScript">
<h1 align="center"><font color="#FF6666">聊友查询</font></h1>
<TABLE cellSpacing=0 cellPadding=2 width="90%" border=0 align=center>
<TR><TD align="right">
	[<a href="javascript:window.close();">关闭窗口</a>]
	[<a href="javascript:window.location.reload();">刷新本页</a>]
</TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=1 align=center class="c1">
    <TR bgcolor=#CCCCFF> 
      <TD colspan=4 align=center> 
    本系统开放[<font color=red><script>document.write(Server.RoomsCount());</script></font>]个聊天室
	总在线人数[<font color=red><script>document.write(Server.TotalUsers);</script></font>]人
	最高在线[<font color=red><script>document.write(Server.MaxOnline);</script></font>]人
	注册用户[<font color=red><script>document.write(Server.RegUsers);</script></font>]人
	  </TD>
  </TR>
</TABLE>
	<script>/*请仔细分析这段代码*/
	// Server.Sort() ; // 按房间人数多少进行排序
	for(var i=0; i < Server.RoomsCount(); i ++)
	{
		var Room = Server.GetRoomObject(i) ; // 写房间信息
		document.write("<TABLE cellSpacing=0 cellPadding=3 width='95%' border=1 align=center class='c1'>");
		document.write("<TR bgcolor=#CCCCFF><TD align=center>") ;
		document.write("<a href='#' onclick='OnLogin(" + i + ")'>" + Room.RoomName + "&nbsp;") ;
		document.write("当前在线[<font color=red>" + Room.UserCount + "</font>]人&nbsp;") ;
		document.write("最高在线[<font color=red>" + Room.MaxOnline + "</font>]人&nbsp;") ;
		document.write("当前话题: " + Room.Topic) ;
		document.write("</a></TD></TR></TABLE>") ;
		if(Room!=null
		&& Room.UserList!=null
		&& Room.UserList.GetCount() > 0)
		{
			document.write("<TABLE cellSpacing=0 cellPadding=1 width='95%' border=1 align=center>");
			document.writeln("  <TR align=middle  bgcolor=LightBlue>");
			document.writeln("	 <TD>序号</TD>") ;
			document.writeln("    <TD>用户名</TD>") ;
			document.writeln("    <TD>昵称</TD>") ;
			document.writeln("    <TD>性别</TD>") ;
			document.writeln("    <TD>在线状态</TD>") ;
			document.writeln("  </TR>") ;
			Room.UserList.Sort() ; // 根据性别排序

			for(var j = 0 ; j < Room.UserList.GetCount(); j ++)
			{		
				var obj = Room.UserList.GetUserObject(j) ;
				document.write("<TR align=middle><TD>" + (j+1) + "</TD>") ;
				document.write("<TD>" + obj.UserName + "</TD>") ;
				document.write("<TD>" + obj.Alias + "</TD><TD>") ;
				if(obj.Sex == 0)	document.write("靓妹") ; else 
				if(obj.Sex == 1)	document.write("帅哥") ;
				else document.write("性别保密") ;
				document.write("</TD><TD>") ;
				if(obj.Status == 1)	document.write("在线") ;
				else	document.write("暂时离开") ;
				document.write("</TD>") ;
				document.write("</TR>") ;
			}
			document.write("</TABLE>") ;
		}
	}
	</script>

<p align=center>Copyright&copy; 2000 All right reserved.<br>
  <A href="http://www.mechat.com/cn/" target=_blank>MeChat&reg;</a><br>
</p>
</BODY>
</HTML>

⌨️ 快捷键说明

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