level 7
function Circle (xPoint, yPoint, radius) {
this.pi=3.14;
this.x = xPoint; // 圆心的 x 坐标。
this.y = yPoint; // 圆心的 y 坐标。
this.r = radius; // 圆的半径。
this.perimeter=2*this.pi*this.r;
this.area=this.pi*this.r*this.r;
this.toString="我是一个圆,圆心在("+this.x+","+
this.y+"),半径长度是"+this.r+"周长是"+
this.perimeter+"面积是"+this.area;
function fun (str) {
alert("..."+str);
return "123"+str;
}
this.haha = fun; // 计算圆面积的函数现在是 Circle Prototype 对象的一个方法。
}
2011年07月30日 05点07分