<script type="text/javascript">
function Base(){
//构造函数 类
}
//累成员
Base.prototype.init=function(){
alert('Base hello');
}
//实例对象
var bs=new Base();
//调用
bs.init();
</script>
<script type="text/javascript">
function Base(){//类
//成员方法
this.show = function(){
alert("Base show");
};
//成员方法
this.init = function(){
alert("Base init");
};
}
//实例对象
var bs=new Base();
//调用
bs.init();
</script>
<script type="text/javascript">
function Base(){//类
}
//成员方法
Base.prototype.show = function(){
alert("ShapeBase show");
};
//成员方法
Base.prototype.init = function(){
alert("ShapeBase init");
};
//静态方法
Base.StaticDraw = function(){
alert("method draw is static");
}
//实例对象
var bs=new Base();
//调用
bs.init();
//调用静态方法
Base.StaticDraw();
</script>
附件下载