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(); |
相关文章推荐
- JavaScript对象的定义,其基本格式如下:
- 第十一讲 面向对象基本概念、类和对象的定义格式及其内存分析
- JavaScript对象的创建之使用json格式定义
- javascript一些让人迷惑的地方--基本数据类型的包装对象
- JavaScript中定义对象的方式,动态添加属性和动态删除属性!
- JavaScript定义对象的2代码种风格和对象属性有两种寻址方式
- JavaScript 时间、格式、转换及Date对象总结
- JavaScript字符串对象(string)基本用法示例
- 定义验证各种格式类型的正则表达式对象 [转]
- JavaScript 类的定义和引用 JavaScript高级培训 自定义对象
- javascript定义对象写法-------作者:虫虫3000 日期:2009-9-7 10:14:9
- javascript有哪些方法定义对象
- JavaScript进阶 函数、定义函数、函数应用、对象
- Javascript中对象的基本用法
- JavaScript编程中布尔对象的基本使用
- JavaScript中对象的定义方式
- JavaScript:常用内置对象window、document、form举例(定义父窗口,接收子窗口返回的内容)
- JavaScript的对象,赋值,即用等号赋值如x=y,也想Java类一样(Java基本数据类型不是这样的)是满足“箭头”黄金定律,如果修改x,y的值也随之改变
- JavaScript中定义对象的四种方式
- javascript工厂方式定义对象