您的位置:首页 > Web前端 > JavaScript

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

2008-09-11 08:28 302 查看
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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: