<1> 关于JS类可以通过以下的方式去定义JS的列
var Studentlei=function Student_fun_lei(var Name,var Age,var Sex,Var Code){
this.Name=Name;
this.Age=Age;
this.Sex=Sex;
this.Code=Code;
}
//实例化一个类
function shili(){
Var StudentDuiXiang=new Studentlei("zhangsan","24","nan","001");
alert(StudentDuiXiang.Name);
//通过对象名加.就可以访问对象里面的属性了
}
(2)关于JS的继承:
function Animal(var Name){
this.Name=Name;
this.eat=function(){
alert(Name+"吃");
}
}
//继承对象
function Cat(){
Animal.call(this,"mao");
}
浙公网安备 33010602011771号