JavaScript对象的定义,其基本格式如下:

JavaScript象的定,其基本格式如下:
Function Object(属性表)
This.prop1=prop1
This.prop2=prop2
...
This.meth=FunctionName1;
This.meth=FunctionName2;
function Animal(name){
        this.name = name;
        this.introduceSelf = function(){
            window.alert("I am a " + this.name+"!");
        };
}
    对象的实例化如下:
var dog = new Animal("dog");
dog. introduceSelf();
posted @ 2008-09-11 08:28  dzqabc  阅读(300)  评论(0编辑  收藏  举报