我在Html档案中附上了javascript。 这给我留下了错误,即“肠道圈子是无法界定的,有助于我解决这个问题。
<html>
<body>
<h1> Testing Object-based Javascipt </h1>
<script type="text/javascript">
function mycircle(x,y,r)
{
this.xcoord=x;
this.ycoord=y;
this.radius=r;
this.area = getArea;
this.getCircumference = function () { return (2 * Math.PI * this.radius ) ; };
}
function getArea()
{
return (Math.PI * this.radius * this.radius);
}
var testCircle = mycircle(3,4,5);
window.alert( The radius of my circle is + testCircle.radius);
</script>
</body>
</html>
Thanks in advance....