遇到一个聊天室程序,帮忙测试解决问题。在线等。

yassee 2003-10-20 05:14:18
<SCRIPT>/** 系统用脚本定义开始,普通用户不建议修改 **/
function ChatRoom()
{
this.Title ; // 房间名称
this.URL ; // 登录地址
this.UserCount ; // 在线人数
this.MaxOnline ; // 最高在线
this.State ; // 满员状态 0=正常 1=热闹 -1=满员禁止登录
this.Topic ; // 当前话题
this.AdminNames ; // 管理员名单
this.RoomType ; // 房间分类ID
this.UserList = null ; // 在线用户列表
}
function ChatServer()
{
this.MaxOnline = 0 ; // 最高在线
this.RegUsers = 0 ; // 总注册人数
this.TotalUsers = 0 ; // 当前在线人数

this.m_pServer = new Array();
this.RoomsCount = function(){return this.m_pServer.length;} // 房间数
this.GetRoomObject = function(n) // 取得房间对象
{ if(n < this.RoomsCount()) return this.m_pServer[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_pServer.sort(this.SortRule);}
this.Add = function(strTitle, strURL, nUserCount, nMax, nState, strTopic, strAdmins, nRoomType)
{ var obj = new ChatRoom() ;
obj.Title = strTitle ; // 房间名称
obj.URL = strURL; // 登录地址
obj.UserCount = nUserCount ; // 在线人数
obj.MaxOnline = nMax ; // 最高在线
obj.State = nState ; // 满员状态 0=正常 1=超员 -1=满员禁止登录
obj.Topic = strTopic ; // 当前话题
obj.AdminNames = strAdmins ; // 管理员名单
obj.RoomType = nRoomType ; // 房间分类ID
this.m_pServer[this.RoomsCount()] = obj ;
}
this.SetCount = function(nMax, nReg, nTotal)
{ this.MaxOnline = nMax ;
this.RegUsers = nReg ;
this.TotalUsers = nTotal ;
}
}
var Server = new ChatServer() ;
/** 系统用脚本定义结束,普通用户不建议修改 **/

/* 请将本页所有 http://127.0.0.1:8888 替换为您已安装好的iChat聊天系统的任一端口 */
/*以下为系统变量和函数库,可以灵活调用,但不推荐修改*/
/*以下为功能模块,允许调整界面时适当修改*/
function OnLogin() // 登录聊天室
{ var n = login.roomlist.value ;
if(n==-1){alert("请先选择房间后登录!") ;return;}
if(!validstr(login.user))return ;
var strBox = "" ;
window.open("about:blank", "iChatMain", "toolbar=no,location=no,directories=no,menubar=no,resizable=yes") ;
login.action = Server.GetRoomObject(n).URL + "Login" ;
login.submit() ;
}
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;
}
//-->
</SCRIPT>
<FORM name=login action=http://211.93.98.11:8887/Login
method=post target=iChatMain>你 的 昵 称:<INPUT maxLength=10
size=10 name=user><BR>你 的 密 码:<INPUT type=password
maxLength=10 size=10 name=pass><FONT
color=red><BR>(游客无须输入密码)</FONT> <BR>性 别:<INPUT
type=radio value=0 name=xb>女<INPUT type=radio CHECKED
value=1 name=xb>男<INPUT type=radio value=2
name=xb>保密<BR><INPUT type=checkbox value=ON
name=boxfunc>启用包厢功能<INPUT type=checkbox value=ON
name=hiddenfunc>管理员隐身</FONT><BR><SELECT name=roomlist>
<OPTION value=-1 selected>请选择房间</OPTION>

<option value="http://211.93.98.11:8889/">真情流露</option>
<option value="http://211.93.98.11:8887/">技术交流</option>
<option value="http://211.93.98.11:8886/">玫瑰情人</option>
<option value="http://211.93.98.11:8885/">心情故事</option>
</SCRIPT>
</SELECT> <INPUT onclick=OnLogin() type=button value=进入 name=button1>

</FORM>

...全文
49 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bineon 2003-10-20
  • 打赏
  • 举报
回复
有什么问题?

——————————————————————————————————
www.91asp.cn
有时间到这里找资料找书籍,你会发现asp以及.net很容易!
前提是你努力学习!
debug2003 2003-10-20
  • 打赏
  • 举报
回复
现在没有时间 看 先收藏一下
qdubit 2003-10-20
  • 打赏
  • 举报
回复
帮楼主顶!

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧