关于firebug的一些讲解
<script type="text/javascript">
function Shape(number)
{
this.number = number;
}
Shape.prototype.getArea = function()
{
return -1;
}
//这是三边形的面积计算
/*function Triangle(width,height)
{
//Shape.call(this,3);
this.width = width;
this.height = height;
}
Triangle.prototype.getArea = function()//相当于java中的重写方法
{
return 0.5 * this.width * this.height;
}
Triangle.prototype.getNumber = function()
{
return this.number;
}
var triangle = new Triangle(12,12);*/
//document.write("该"+triangle.getNumber()+"边形的面积是:"+triangle.getArea());
//这是四边形的面积计算
function Rentage(width, height)
{
Shape.call(this,4);
this.width = width;
this.height = height;
}
Rentage.prototype = new Shape();
Rentage.prototype.getArea = function()//函数重写
{
return this.width * this.height;
}
Rentage.prototype.getNumber = function()
{
return this.number;
}
var rentage = new Rentage(3,4);
//alert("asd");
//alert(rentage.getNumber());
//alert(rentage.getArea());
document.write("该" + rentage.getNumber() + "形的面积是:" + rentage.getArea());
//关于firebug的控制台的一些调试方法
function showMessage(message)
{
console.log(message);
console.info(message);
console.error(message);
console.warn(message);
console.debug(message);
}
function test(name)
{
showMessage(name);
}
test("姓名");
document.wrute("asds");
</script>