欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS 對象介紹

 更新時(shí)間:2010年01月20日 00:58:42   作者:  
JS 對象介紹,需要的朋友可以參考下。

JavaScript is an Object Oriented Programming (OOP) language.
JS是面向?qū)ο蟮木幊陶Z言(面向?qū)ο螅?(這里是基于對象還是面向?qū)ο蟠蠹铱梢运阉飨拢?BR>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)語言,這就可以讓你定義....(和上面的重復(fù))
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里介紹建立自定義對象。我們將開始觀察內(nèi)建JS對象和如何使用它們。下頁將詳細(xì)介紹每個(gè)內(nèi)建JS對象
Note that an object is just a special kind of data. An object has properties and methods.
注意,對象只是特殊類型的數(shù)據(jù)。對象有屬性和方法

--------------------------------------------------------------------------------
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:
下面的例子我么使用了字符串對象的長度屬性來返回字符的數(shù)量:
<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.
對象的方法可以執(zhí)行行為。
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!

相關(guān)文章

  • javascript 寫類方式之四

    javascript 寫類方式之四

    構(gòu)造函數(shù) + 原型 直接組裝一個(gè)類;同一構(gòu)造函數(shù)將組裝出同一類型
    2009-07-07
  • JavaScript面向?qū)ο笤O(shè)計(jì)二 構(gòu)造函數(shù)模式

    JavaScript面向?qū)ο笤O(shè)計(jì)二 構(gòu)造函數(shù)模式

    在Javascript面向?qū)ο笤O(shè)計(jì)一——工廠模式 中介紹了使用CreateEmployee()函數(shù)創(chuàng)建員工類。ECMAScript中的構(gòu)造函數(shù)可以用來創(chuàng)建特定類型的對象,如Object和Array這樣的原生構(gòu)造函數(shù),在運(yùn)行時(shí)會自動出現(xiàn)在執(zhí)行環(huán)境中,此外也可以創(chuàng)建自定義的構(gòu)造函數(shù),從而創(chuàng)建自定義對象類型的屬性和方法
    2011-12-12
  • 面向?qū)ο蟮膉avascript(筆記)

    面向?qū)ο蟮膉avascript(筆記)

    面向?qū)ο蟮膉avascript之學(xué)習(xí)筆記,需要學(xué)習(xí)的朋友可以參考下,腳本之家之前更新了不少這方便的文章。
    2009-10-10
  • 最新評論