如何写自定义对象的方法
redv 2002-08-13 06:09:59 function setErrorNumber(num)
{
this.number=num;//这里这么写
switch(this.number)
{
case 0:this.brief="Session is empty.";break;
case 1:this.brief="数据库中没有您的信息。";break;
case 2:this.brief="您的密码与用户名不匹选。";break;
default:this.brief="未知的错误。";
}
}
function getErrorNumber()//得到对象中的this.number的值
{
return this.number;//这里这么写
}
function UserError()
{
//Methods
this.setErrorNumber;
this.getErrorNumber;
//Properties
this.number=0;
this.brief="";
}