JS 对象介绍


Posted in Javascript onJanuary 20, 2010

JavaScript is an Object Oriented Programming (OOP) language.
JS是面向对象的编程语言(面向对象)。 (这里是基于对象还是面向对象大家可以搜索下)
An OOP language allows you to define your own objects and make your own variable types.
OOP语言可以让你自定义对象和变量类型。

--------------------------------------------------------------------------------
Object Oriented Programming
被安置对象的编程
JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to define your own objects and make your own variable types.
JS是(OOP)语言,这就可以让你定义....(和上面的重复)
However, creating your own objects will be explained later, in the Advanced JavaScript section. We will start by looking at the built-in JavaScript objects, and how they are used. The next pages will explain each built-in JavaScript object in detail.
然而,我们将晚些在高级JS里介绍建立自定义对象。我们将开始观察内建JS对象和如何使用它们。下页将详细介绍每个内建JS对象
Note that an object is just a special kind of data. An object has properties and methods.
注意,对象只是特殊类型的数据。对象有属性和方法

--------------------------------------------------------------------------------
Properties
属性
Properties are the values associated with an object.
属性是对象的相连值
In the following example we are using the length property of the String object to return the number of characters in a string:
下面的例子我么使用了字符串对象的长度属性来返回字符的数量:
<script type="text/javascript">
var txt="Hello World!"
document.write(txt.length)
</script>
The output of the code above will be:
上面的代码就会输出:
12

--------------------------------------------------------------------------------
Methods
方法
Methods are the actions that can be performed on objects.
对象的方法可以执行行为。
In the following example we are using the toUpperCase() method of the String object to display a text in uppercase letters:
下面的例子使用了字符串对象的toUpperCase()方法来显示出文字的大写:
<script type="text/javascript">
var str="Hello world!"
document.write(str.toUpperCase())
</script>
The output of the code above will be:
上面的代码输出:
HELLO WORLD!

Javascript 相关文章推荐
Javascript 通过json自动生成Dom的代码
Apr 01 Javascript
Javascript 面向对象 对象(Object)
May 13 Javascript
仿微博字符限制效果实现代码
Apr 20 Javascript
浅析JavaScript中的typeof运算符
Nov 30 Javascript
10分钟学会写Jquery插件实例教程
Sep 06 Javascript
node.js中的fs.writeFileSync方法使用说明
Dec 14 Javascript
js的回调函数详解
Jan 05 Javascript
jQuery中(function($){})(jQuery)详解
Jul 15 Javascript
分享Javascript实用方法二
Dec 13 Javascript
javascript瀑布流布局实现方法详解
Feb 17 Javascript
jquery实现聊天机器人
Feb 08 jQuery
JS代码简洁方式之函数方法详解
Jul 28 Javascript
JavaScript 学习笔记(十一)
Jan 19 #Javascript
9个JavaScript评级/投票插件
Jan 18 #Javascript
jQuery Flash/MP3/Video多媒体插件
Jan 18 #Javascript
使用IE6看老赵的博客 jQuery初探
Jan 17 #Javascript
jQuery+CSS 实现的超Sexy下拉菜单
Jan 17 #Javascript
JS与框架页的操作代码
Jan 17 #Javascript
JavaScript写的一个自定义弹出式对话框代码
Jan 17 #Javascript
You might like
php正则
2006/07/07 PHP
PHP调用C#开发的dll类库方法
2014/07/28 PHP
PHP生成RSS文件类实例
2014/12/05 PHP
PHP日期函数date格式化UNIX时间的方法
2015/03/19 PHP
PHP编程实现计算抽奖概率算法完整实例
2017/08/09 PHP
php利用云片网实现短信验证码功能的示例代码
2017/11/18 PHP
JQuery 表格操作(交替显示、拖动表格行、选择行等)
2009/07/29 Javascript
JS定时器实例
2013/04/17 Javascript
js阻止事件追加的具体实现
2014/10/15 Javascript
深入讲解AngularJS中的自定义指令的使用
2015/06/18 Javascript
javascript的BOM汇总
2015/07/16 Javascript
jQuery实现的精美平滑二级下拉菜单效果代码
2016/03/28 Javascript
jquery实现图片上传前本地预览功能
2016/05/10 Javascript
基于jQuery ligerUI实现分页样式
2016/09/18 Javascript
老生常谈javascript变量的命名规范和注释
2016/09/29 Javascript
JS实现快速比较两个字符串中包含有相同数字的方法
2017/09/11 Javascript
js实现一款简单踩白块小游戏(曾经很火)
2019/12/02 Javascript
利用soaplib搭建webservice详细步骤和实例代码
2013/11/20 Python
python中pygame模块用法实例
2014/10/09 Python
python使用pymysql实现操作mysql
2016/09/13 Python
Python实现的个人所得税计算器示例
2018/06/01 Python
Python解决两个整数相除只得到整数部分的实例
2018/11/10 Python
Python实现字典排序、按照list中字典的某个key排序的方法示例
2018/12/18 Python
python批量识别图片指定区域文字内容
2019/04/30 Python
对Python 简单串口收发GUI界面的实例详解
2019/06/12 Python
Django继承自带user表并重写的例子
2019/11/18 Python
佳能法国商店:Canon法国
2019/02/14 全球购物
英国Lookfantastic中文网站:护肤品美妆美发购物(英国直邮)
2020/04/27 全球购物
后勤园长自我鉴定
2013/10/17 职场文书
怎么写有吸引力的自荐信
2013/11/17 职场文书
常务副总经理岗位职责
2014/04/12 职场文书
校庆标语集锦
2014/06/25 职场文书
个人学习群众路线心得体会
2014/11/05 职场文书
文明班级申报材料
2014/12/24 职场文书
应聘教师求职信范文
2015/03/20 职场文书
结婚幸福感言
2015/08/01 职场文书