请问这个构造函数链为什么不成功啊
<script>
function Retangle(w,h){
this.width=w;
this.height=h;
}
Retangle.prototype.area=function(){return this.width*this.height}
function PositionRetangle(x,y,w,h){
this.superclass(w,h);
this.x=x
this.y=y
}
PositionRetangle.prototype.superclass=Retangle
a=new PositionRetangle(4,9,5,7)
alert(a.area())
</script>
怎么让a 弹出面积值35啊? 少写了什么吗
------解决方案--------------------
<script type="text/javascript">
function Retangle(w,h){
this.width=w;
this.height=h;
Retangle.prototype.area=function(){return this.width*this.height};
}
function PositionRetangle(x,y){
this.x=x;
this.y=y;
}
PositionRetangle.prototype=new Retangle(5,7);
var a=new PositionRetangle(4,9);
alert(a.area());
</script>