JavaScript: The Definitive Guide, 5/e
暫譯: JavaScript:權威指南,第5版

David Flanagan

  • 出版商: O'Reilly
  • 出版日期: 2006-08-27
  • 售價: $1,880
  • 貴賓價: 9.5$1,786
  • 語言: 英文
  • 頁數: 1032
  • 裝訂: Paperback
  • ISBN: 0596101996
  • ISBN-13: 9780596101992
  • 相關分類: JavaScript
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description

This Fifth Edition is completely revised and expanded to cover JavaScript as it is used in today's Web 2.0 applications. This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including:

  • Scripted HTTP and Ajax
  • XML processing
  • Client-side graphics using the <canvas> tag
  • Namespaces in JavaScript--essential when writing complex programs
  • Classes, closures, persistence, Flash, and JavaScript embedded in Java applications

Part I explains the core JavaScript language in detail. If you are new to JavaScript, it will teach you the language. If you are already a JavaScript programmer, Part I will sharpen your skills and deepen your understanding of the language.

Part II explains the scripting environment provided by web browsers, with a focus on DOM scripting with unobtrusive JavaScript. The broad and deep coverage of client-side JavaScript is illustrated with many sophisticated examples that demonstrate how to:

  • Generate a table of contents for an HTML document
  • Display DHTML animations
  • Automate form validation
  • Draw dynamic pie charts
  • Make HTML elements draggable
  • Define keyboard shortcuts for web applications
  • Create Ajax-enabled tool tips
  • Use XPath and XSLT on XML documents loaded with Ajax
  • And much more

Part III is a complete reference for core JavaScript. It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript version 3.

Part IV is a reference for client-side JavaScript, covering legacy web browser APIs, the standard Level 2 DOM API, and emerging standards such as the XMLHttpRequest object and the <canvas> tag.

More than 300,000 JavaScript programmers around the world have made this their indispensable reference book for building JavaScript applications.

"A must-have reference for expert JavaScript programmers...well-organized and detailed."
-- Brendan Eich, creator of JavaScript

 

Table of Contents

Preface

1. Introduction to JavaScript

      1.1 What Is JavaScript?  

      1.2 Versions of JavaScript  

      1.3 Client-Side JavaScript  

      1.4 JavaScript in Other Contexts  

      1.5 Exploring JavaScript  

Part I. Core JavaScript

2. Lexical Structure

      2.1 Character Set  

      2.2 Case Sensitivity  

      2.3 Whitespace and Line Breaks  

      2.4 Optional Semicolons  

      2.5 Comments  

      2.6 Literals  

      2.7 Identifiers  

      2.8 Reserved Words  

3. Datatypes and Values

      3.1 Numbers  

      3.2 Strings  

      3.3 Boolean Values  

      3.4 Functions  

      3.5 Objects  

      3.6 Arrays  

      3.7 null  

      3.8 undefined  

      3.9 The Date Object  

      3.10 Regular Expressions  

      3.11 Error Objects  

      3.12 Type Conversion Summary  

      3.13 Primitive Datatype Wrapper Objects  

      3.14 Object-to-Primitive Conversion  

      3.15 By Value Versus by Reference  

4. Variables

      4.1 Variable Typing  

      4.2 Variable Declaration  

      4.3 Variable Scope  

      4.4 Primitive Types and Reference Types  

      4.5 Garbage Collection  

      4.6 Variables as Properties  

      4.7 Variable Scope Revisited  

5. Expressions and Operators

      5.1 Expressions  

      5.2 Operator Overview  

      5.3 Arithmetic Operators  

      5.4 Equality Operators  

      5.5 Relational Operators  

      5.6 String Operators  

      5.7 Logical Operators  

      5.8 Bitwise Operators  

      5.9 Assignment Operators  

      5.10 Miscellaneous Operators  

6. Statements

      6.1 Expression Statements  

      6.2 Compound Statements  

      6.3 if  

      6.4 else if  

      6.5 switch  

      6.6 while  

      6.7 do/while  

      6.8 for  

      6.9 for/in  

      6.10 Labels  

      6.11 break  

      6.12 continue  

      6.13 var  

      6.14 function  

      6.15 return  

      6.16 throw  

      6.17 try/catch/finally  

      6.18 with  

      6.19 The Empty Statement  

      6.20 Summary of JavaScript Statements  

7. Objects and Arrays

      7.1 Creating Objects  

      7.2 Object Properties  

      7.3 Objects as Associative Arrays  

      7.4 Universal Object Properties and Methods  

      7.5 Arrays  

      7.6 Reading and Writing Array Elements  

      7.7 Array Methods  

      7.8 Array-Like Objects  

8. Functions

      8.1 Defining and Invoking Functions  

      8.2 Function Arguments  

      8.3 Functions as Data  

      8.4 Functions as Methods  

      8.5 Constructor Functions  

      8.6 Function Properties and Methods  

      8.7 Utility Function Examples  

      8.8 Function Scope and Closures  

      8.9 The Function(  ) Constructor  

9. Classes, Constructors, and Prototypes

      9.1 Constructors  

      9.2 Prototypes and Inheritance  

      9.3 Simulating Classes in JavaScript  

      9.4 Common Object Methods  

      9.5 Superclasses and Subclasses  

      9.6 Extending Without Inheriting  

      9.7 Determining Object Type  

      9.8 Example: A defineClass(  ) Utility Method  

10. Modules and Namespaces

      10.1 Creating Modules and Namespaces  

      10.2 Importing Symbols from Namespaces  

      10.3 Module Utilities  

11. Pattern Matching with Regular Expressions

      11.1 Defining Regular Expressions  

      11.2 String Methods for Pattern Matching  

      11.3 The RegExp Object  

12. Scripting Java

      12.1 Embedding JavaScript  

      12.2 Scripting Java  

Part II. Client-Side JavaScript

13. JavaScript in Web Browsers

      13.1 The Web Browser Environment  

      13.2 Embedding Scripts in HTML  

      13.3 Event Handlers in HTML  

      13.4 JavaScript in URLs  

      13.5 Execution of JavaScript Programs  

      13.6 Client-Side Compatibility  

      13.7 Accessibility  

      13.8 JavaScript Security  

      13.9 Other Web-Related JavaScript Embeddings  

14. Scripting Browser Windows

      14.1 Timers  

      14.2 Browser Location and History  

      14.3 Obtaining Window, Screen, and Browser Information  

      14.4 Opening and Manipulating Windows  

      14.5 Simple Dialog Boxes  

      14.6 Scripting the Status Line  

      14.7 Error Handling  

      14.8 Multiple Windows and Frames  

      14.9 Example: A Navigation Bar in a Frame  

15. Scripting Documents

      15.1 Dynamic Document Content  

      15.2 Document Properties  

      15.3 Legacy DOM: Document Object Collections  

      15.4 Overview of the W3C DOM  

      15.5 Traversing a Document  

      15.6 Finding Elements in a Document  

      15.7 Modifying a Document  

      15.8 Adding Content to a Document  

      15.9 Example: A Dynamically Created Table of Contents  

      15.10 Querying Selected Text  

      15.11 The IE 4 DOM  

16. Cascading Style Sheets and Dynamic HTML

      16.1 Overview of CSS  

      16.2 CSS for DHTML  

      16.3 Scripting Inline Styles  

      16.4 Scripting Computed Styles  

      16.5 Scripting CSS Classes  

      16.6 Scripting Stylesheets  

17. Events and Event Handling

      17.1 Basic Event Handling  

      17.2 Advanced Event Handling with DOM Level 2  

      17.3 The Internet Explorer Event Model  

      17.4 Mouse Events  

      17.5 Key Events  

      17.6 The onload Event  

      17.7 Synthetic Events  

18. Forms and Form Elements

      18.1 The Form Object  

      18.2 Defining Form Elements  

      18.3 Scripting Form Elements  

      18.4 Form Verification Example  

19. Cookies and Client-Side Persistence

      19.1 An Overview of Cookies  

      19.2 Storing Cookies  

      19.3 Reading Cookies  

      19.4 Cookie Example  

      19.5 Cookie Alternatives  

      19.6 Persistent Data and Security  

20. Scripting HTTP

      20.1 Using XMLHttpRequest  

      20.2 XMLHttpRequest Examples and Utilities  

      20.3 Ajax and Dynamic Scripting  

      20.4 Scripting HTTP with <script> Tags  

21. JavaScript and XML

      21.1 Obtaining XML Documents  

      21.2 Manipulating XML with the DOM API  

      21.3 Transforming XML with XSLT  

      21.4 Querying XML with XPath  

      21.5 Serializing XML  

      21.6 Expanding HTML Templates with XML Data  

      21.7 XML and Web Services  

      21.8 E4X: ECMAScript for XML  

22. Scripted Client-Side Graphics

      22.1 Scripting Images  

      22.2 Graphics with CSS  

      22.3 SVG: Scalable Vector Graphics  

      22.4 VML: Vector Markup Language  

      22.5 Graphics in a <canvas>  

      22.6 Graphics with Flash  

      22.7 Graphics with Java  

23. Scripting Java Applets and Flash Movies

      23.1 Scripting Applets  

      23.2 Scripting the Java Plug-in  

      23.3 Scripting with Java  

      23.4 Scripting Flash  

      23.5 Scripting Flash 8  

Part III. Core JavaScript Reference

Core JavaScript Reference

Part IV. Client-Side JavaScript Reference

Client-Side JavaScript Reference

Index

商品描述(中文翻譯)

**描述**

本書第五版已全面修訂和擴充,以涵蓋當今 Web 2.0 應用程式中使用的 JavaScript。本書既是以範例為驅動的程式設計師指南,也是隨手可用的參考書,新增的章節解釋了您需要了解的所有內容,以充分利用 JavaScript,包括:

- 腳本化的 HTTP 和 Ajax
- XML 處理
- 使用 標籤的客戶端圖形
- JavaScript 中的命名空間——在編寫複雜程式時至關重要
- 類別、閉包、持久性、Flash 以及嵌入 Java 應用程式中的 JavaScript

第一部分詳細解釋了核心 JavaScript 語言。如果您是 JavaScript 新手,它將教您這門語言。如果您已經是 JavaScript 程式設計師,第一部分將提升您的技能並加深您對語言的理解。

第二部分解釋了網頁瀏覽器提供的腳本環境,重點是使用不干擾的 JavaScript 進行 DOM 腳本編寫。客戶端 JavaScript 的廣泛和深入的覆蓋通過許多複雜的範例來說明,這些範例展示了如何:

- 為 HTML 文檔生成目錄
- 顯示 DHTML 動畫
- 自動化表單驗證
- 繪製動態圓餅圖
- 使 HTML 元素可拖動
- 為網頁應用程式定義鍵盤快捷鍵
- 創建支持 Ajax 的工具提示
- 在使用 Ajax 加載的 XML 文檔上使用 XPath 和 XSLT
- 以及更多

第三部分是核心 JavaScript 的完整參考。它記錄了 JavaScript 1.5 和 ECMAScript 版本 3 定義的每個類別、物件、建構函數、方法、函數、屬性和常數。

第四部分是客戶端 JavaScript 的參考,涵蓋了舊版網頁瀏覽器 API、標準 Level 2 DOM API 以及新興標準,如 XMLHttpRequest 物件和 標籤。

全球超過 300,000 名 JavaScript 程式設計師已將本書視為構建 JavaScript 應用程式的不可或缺的參考書。

*「對於專業的 JavaScript 程式設計師來說,這是一本必備的參考書……組織良好且詳細。」*
—— Brendan Eich,JavaScript 創造者

**目錄**

**前言**

**1. JavaScript 簡介**
      1.1 JavaScript 是什麼?
      1.2 JavaScript 的版本
      1.3 客戶端 JavaScript
      1.4 JavaScript 在其他上下文中的應用
      1.5 探索 JavaScript

**第一部分. 核心 JavaScript**
**2. 詞法結構**
      2.1 字符集
      2.2 大小寫敏感性
      2.3 空白和換行
      2.4 可選的分號
      2.5 註釋
      2.6 字面量
      2.7 標識符
      2.8 保留字

**3. 數據類型和值**
      3.1 數字
      3.2 字符串
      3.3 布林值
      3.4 函數
      3.5 物件
      3.6 陣列
      3.7 null
      3.8 undefined
      3.9 日期物件
      3.10 正則表達式
      3.11 錯誤物件
      3.12 類型轉換摘要
      3.13 原始數據類型包裝物件
      3.14 物件到原始類型的轉換
      3.15 值傳遞與引用傳遞

**4. 變數**
      4.1 變數類型
      4.2 變數聲明
      4.3 變數範圍
      4.4 原始類型和引用類型
      4.5 垃圾回收
      4.6 變數作為屬性
      4.7 變數範圍重訪

**5. 表達式和運算符**
      5.1 表達式
      5.2 運算符概述
      5.3 算術運算符
      5.4 相等運算符
      5.5 關係運算符
      5.6 字符串運算符
      5.7 邏輯運算符
      5.8 位運算符
      5.9 賦值運算符
      5.10 其他運算符

**6. 語句**
      6.1 表達式語句
      6.2 複合語句
      6.3 if
      6.4 else if
      6.5 switch
      6.6 while
      6.7 do/while
      6.8 for
      6.9 for/in
      6.10 標籤
      6.11 break
      6.12 continue
      6.13 var
      6.14 function
      6.15 return
      6.16 throw
      6.17 try/catch/finally
      6.18 with
      6.19 空語句
      6.20 JavaScript 語句摘要

**7. 物件和陣列**
      7.1 創建物件
      7.2 物件屬性
      7.3 物件作為關聯陣列
      7.4 通用物件屬性和方法
      7.5 陣列
      7.6 讀取和寫入陣列元素
      7.7 陣列方法
      7.8 類似陣列的物件

**8. 函數**
      8.1 定義和調用函數
      8.2 函數參數
      8.3 函數作為數據
      8.4 函數作為方法
      8.5 建構函數
      8.6 函數屬性和方法
      8.7 實用函數範例
      8.8 函數範圍和閉包
      8.9 Function() 建構函數

**9. 類別、建構函數和原型**
      9.1 建構函數
      9.2 原型和繼承
      9.3 在 JavaScript 中模擬類別
      9.4 常見物件方法
      9.5 超類和子類
      9.6 無繼承擴展
      9.7 確定物件類型
      9.8 範例:一個 defineClass() 實用方法

**10. 模組和命名空間**
      10.1 創建模組和命名空間
      10.2 從命名空間導入符號
      10.3 模組實用工具

**11. 使用正則表達式進行模式匹配**
      11.1 定義正則表達式
      11.2 用於模式匹配的字符串方法
      11.3 RegExp 物件

**12. 腳本化 Java**
      12.1 嵌入 JavaScript
      12.2 腳本化 Java

**第二部分. 客戶端 JavaScript**
**13. 網頁瀏覽器中的 JavaScript**
      13.1 網頁瀏覽器環境
      13.2 在 HTML 中嵌入腳本
      13.3 HTML 中的事件處理器
      13.4 URL 中的 JavaScript
      13.5 JavaScript 程式的執行
      13.6 客戶端兼容性
      13.7 可及性
      13.8 JavaScript 安全性