当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JS 对象介绍

Javascript
用JavaScript实现浏览器地震效果
Javascript实例教程(8) 利用Javascript基于浏览器类型的重定向
Javascript实例教程(14) 鼠标触发窗口
使主页呈现“飞舞”特效
Javascript实例教程(21) OLE Automation(1)
Javascript实例教程(13) 鼠标移过时报警
Javascript实例教程(10) 随机显示图片
Javascript实例教程(2) 创建弹出式窗口
JavaScript 小技巧(第十集)
Javascript实例教程(3) 创建折叠式导航菜单
Javascript实例教程(7) 利用Javascript进行密码保护
完美解决一个事件激活多个函数(2)
Javascript模拟游戏中的弹出菜单效果
Javascript实例教程(6) 在一个表单中设置和检查Cookies
JavaScript 小技巧(第八集)
Javascript实例教程(4) 探测浏览器插件
JavaScript 小技巧(第九集)
JavaScript学习:基础继承机制
初学Javascript之cookie篇(译)
让弹出窗口变得“体贴”一些(javascript)

Javascript 中的 JS 对象介绍


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-02-27   浏览: 52 ::
收藏到网摘: n/a

JS 对象介绍,需要的朋友可以参考下。

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!