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

📄 login.js

📁 一个C语言的聊天室源代码
💻 JS
字号:
function openIT(W,H,theurl,wname) // 弹出新窗口
{
	windowCERRARa 		= "close_a.gif"
	windowCERRARd 		= "close_d.gif"
	windowCERRARo 		= "close_o.gif"
	windowTIT 	    	= "<font face=verdana style='font-size:12px'>&nbsp;SocketChat 2001&nbsp;-&nbsp;http://www.socketchat.com</font>"
	windowBORDERCOLOR   	= "#000000"
	windowBORDERCOLORsel	= "#0a0a0a"
	windowTITBGCOLOR    	= "#ffb729"
	windowTITBGCOLORsel 	= "#ffd749"
	if( W == 0 )	W=window.screen.width;
	if( H == 0 )	H=window.screen.height-50;

	var windowW = W;
	var windowH = H;
	var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
	var windowY = Math.ceil( (window.screen.height-50 - windowH) / 2 );

	if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) isie=true
	else											     isie=false

	if (isie) { H=H+20+2; W=W+2; }

	s = ",width="+W+",height="+H;

	if (isie) {
		var parameters = escape( theurl+"|"+windowCERRARa+"|"+windowCERRARd+"|"+windowCERRARo+"|"+windowTIT+"|"+windowBORDERCOLOR+"|"+windowBORDERCOLORsel+"|"+windowTITBGCOLOR+"|"+windowTITBGCOLORsel)
		var theurl="chromeless.html?"+parameters

		splashWin = window.open( "" , wname, "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0")

		splashWin.resizeTo( Math.ceil( W )       , Math.ceil( H ) )
		splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) )
		splashWin.location = theurl

	}
	else    var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true)
	splashWin.focus();
}
/*以下为功能模块,允许调整界面时适当修改*/
function OnLogin(n) // 登录聊天室
{	
	if(!validstr(login.user))return ;
	var strBox = "" ;
	if(login.boxfunc.checked == true)	strBox = "&box=on";
	var strSex = "&sex=" + login.sex.value ;
	// openIT(0,0,"/cmd?Login&user="+login.user.value+"&pass="+escape(login.pass.value) + "&roomid=" + n + strSex + strBox + "&sid=" + sid,"");
	window.open("/cmd?Login&user="+login.user.value+"&pass="+escape(login.pass.value) + "&roomid=" + n + strSex + strBox + "&sid=" + sid,"","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
}
function OnUserList(n) // 查询在线用户列表
{
	window.open("/cmd?OnlineUserList" + "&roomid=" + n + "&r=sid" + sid,"_onlineuserlist","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400");
}
function OnRegister() // 注册呢称 (GetRoomURL(0)的参数0可设置从那个房间内获取注册表单,建立选择一个人数少的房间让用户注册呢称)
{	window.open("register.htm","_register","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,width=270,height=400");
}
function OnAllUsers() // 显示在线用户总列表
{	window.open("/cmd?OnlineUserList&sid=" + sid,"_onlineuserlist","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
}
function OnFindUser() // 查找在线用户
{
	var strUserName = prompt("请输入您要查找的用户名?", "找谁?") ;
	if(strUserName == null || strUserName == "找谁?" || strUserName.length <1)	return ;
	window.open("/cmd?FindUser&user="+strUserName,"_finduser","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
}
function validstr(str) // 验证用户名
{
	var s,i,j;
	s=" +=|'#&<>%*`^/\\\";,.";
	str1=str.value.toString();
	if (str.value.length <1)
	{
		alert("呢称不能为空!");
		str.focus();
		return false;
	}
	for (i=0; i<str1.length; i++)
	{
		for(j=0;j<s.length;j++)
		{
			if (str1.charAt(i) == s.charAt(j))
			{
				alert("名字中不能包含特殊字符: +=|'#&<>%*`^/\\\";,.空格.");
		 		str.focus(); return false;
			}
		}
	}
	return true;
}

⌨️ 快捷键说明

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