Skip to Content
JAVASCRIPT網頁應用程式設計
book

JAVASCRIPT網頁應用程式設計

by Alex MacCaw
January 2013
Intermediate to advanced
332 pages
5h 23m
Chinese
GoTop Information, Inc.
Content preview from JAVASCRIPT網頁應用程式設計
附錄 A
jQuery 入門
目前已經有相當多的 JavaScript 函式庫,能夠協助簡化操控 DOM 元件的工作。但這當
中像 jQuery 這樣備受推崇,又廣受大家喜愛的函式庫並不多。jQuery 的成功自有其道
理:它的 API 很好用、函式庫輕薄短小,而且又有妥善運用命名空間的概念(即使同時
jQuery 和其他的函式庫混用,也不會發生任何衝突)。除此之外,jQuery 的功能很容
易擴充,目前已經有非常多的外掛程式(
http://plugins.jquery.com
)可供選用,內容包羅
萬象,從 JavaScript 的資料驗證,到進度列都有。
jQuery 函式庫裡的所有成員,都隸屬於相同的名稱空間—也就是
jQuery
變數。它的
別名是金錢符號(
$
)。有些函式庫會去擴充一些 JavaScript 內建物件,像是 Prototype
http://prototypejs.org
)就會這麼做。但 jQuery 不會這麼做,主要就是為了避免發生和
其他函式庫衝突的狀況。
學習 jQuery 時,另一個很重要的概念,就是選取項(selector)。對於熟悉 CSS 的人而
言,使用選取項應該就像喝水一樣自然。所有 jQuery 的實體函式,都得透過選取項來執
行,也就是說,如果要一次處理多組網頁元件,不用自己寫程式逐一挑選所需的網頁元
件,只要選用一組能夠涵蓋到這些網頁元件的選取項即可。透過 jQuery 選取項呼叫的函
式,都會直接套用至該選取項所涵蓋的所有網頁元件。
我們可以利用兩段範例程式 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

Ethan Brown, 武舎 広幸, 武舎 るみ
PHP编程:第4版

PHP编程:第4版

Kevin Tatroe, Peter MacIntyre
Strange Code

Strange Code

Ronald T. Kneusel
Perfecting Your Thinking Skills

Perfecting Your Thinking Skills

MIT Sloan Management Review

Publisher Resources

ISBN: 9789862766811