Contents

                  Acknowledgments

                  Introduction

PART I    JavaScript Basics


        LESSON 1    Introduction to JavaScript

                  In the Beginning

                          In-browser Scripting

                  Info for Programmers

                          All About Objects

                  Why You Need to Know JavaScript

                  Summary

                  Self-Test Questions

        LESSON 2    Incorporating JavaScript into a Web Page

                  Using Comments

                          Using Semicolons

                  Where to Place the JavaScript Code

                          In the Document Head

                          In the Document Body

                          Including JavaScript Files

                  JavaScript Language Syntax

                          Case Sensitivity

                          Whitespace

                  Variables

                          Variable Naming

                          String Variables

                          Variable Typing and Casting

                  Summary

                  Self-Test Questions

        LESSON 3    Working with Arithmetic Operators and Functions

                  Arithmetic Operators

                          Pre-Incrementing

                          Post-Incrementing

                          Pre- and Post-Decrementing

                  Arithmetic Functions

                  Assignment Operators

                  Summary

                  Self-Test Questions

        LESSON 4    Applying Comparison and Logical Operators

                  Comparison Operators

                  Logical Operators

                          The Ternary Operator

                          Bitwise Operators

                  Operator Precedence

                  Operator Associativity

                  The with Keyword

                  Summary

                  Self-Test Questions

        LESSON 5    Creating JavaScript Arrays

                  Array Names

                  Creating an Array

                          Creating an Array of Specific Length

                          Assigning Values to an Array Element

                          Using Indexes

                          Retrieving Values

                          Using Array Elements as Indexes

                  Other Ways of Creating Arrays

                  Using Associative Arrays

                          Keys, Values, and Hash Tables

                          Other Ways of Creating an Associative Array

                  Summary

                  Self-Test Questions

        LESSON 6    Accessing Multidimensional Arrays

                  Creating a Two-Dimensional Array

                  Accessing a Two-Dimensional Array

                  A More Practical Example

                  Multidimensional Associative Arrays

                          Creating the Multidimensional Array

                          Accessing the Arrays

                  Summary

                  Self-Test Questions

        LESSON 7    Calling Array Functions

                  Using for(… in …)

                  Using concat()

                          An Alternative to concat()

                  Using join()

                  The forEach() Function

                  The map() Function

                  Summary

                  Self-Test Questions

PART II    Advanced JavaScript


        LESSON 8    Pushing to and Popping from Arrays

                  Using push()

                  Using pop()

                  Using push() and pop() Together

                  Using reverse()

                  Using Stacks and Buffers

                          Buffering Using an Array

                          Creating a Function for Pushing to the Top

                  Summary

                  Self-Test Questions

        LESSON 9    Advanced Array Manipulation

                  Using sort()

                          Tailoring the sort() Function

                          Sorting Numerically

                          Reversing a Sort

                  Using splice()

                          Removing Elements from an Array

                          Inserting Elements into an Array

                          Advanced Array Splicing

                  Summary

                  Self-Test Questions

         LESSON 10  Controlling Program Flow

                  The if() Statement

                          Omitting the Braces

                          Positioning of Braces

                  The else Statement

                          The else if() Statement

                  The switch() Statement

                          Using the break Keyword

                          Using the default Keyword

                          Allowing Fall-Through

                  Summary

                  Self-Test Questions

         LESSON 11  Looping Sections of Code

                  Using while() Loops

                          The Example in Detail

                  Using do … while() Loops

                          The Example in Detail

                  Using for() Loops

                          The Example in Detail

                  Using for(… in …) Loops

                          Breaking Out of a Loop

                          The continue Statement

                  Summary

                  Self-Test Questions

         LESSON 12  Writing Functions

                  Using Functions

                          The return Keyword

                          Passing Arguments

                          Accessing Arguments

                          Using the arguments Object

                          Using the this Keyword

                  Anonymous Functions

                  Global and Local Variable Scope

                          Using Local Variables

                  Global Naming Convention

                  Summary

                  Self-Test Questions

         LESSON 13  Manipulating JavaScript Objects

                  Declaring a Class

                          Creating an Object

                          Accessing Objects

                  The prototype Keyword

                          Extending JavaScript Functions

                  Summary

                  Self-Test Questions

         LESSON 14  Handling Errors and Regular Expressions

                  Using onerror

                          Limiting the Scope of onerror

                  Using try … catch()

                          Ignoring the Error

                  Regular Expressions

                  Using test()

                  Using replace()

                          Replacing Globally

                          Fuzzy Matching

                          Matching Any Character

                          Not Matching a Character

                  Summary

                  Self-Test Questions

         LESSON 15  Interacting with the Document Object Model

                  The DOM

                  Accessing the DOM from JavaScript

                          Using the getElementById() Function

                          The Simpler O() Function

                          The Partner S() Function

                          Accessing Multiple Elements by Class

                          Using the C() Function

                          The Difference Between Properties in CSS and JavaScript

                          Summary of the Three Functions

                  Some Common Properties

                          Other Properties

                  Summary

                  Self-Test Questions

         LESSON 16  Inserting Inline JavaScript and Events

                  Inline JavaScript

                          Another Instance of this

                          Non-inline Event Attaching

                          Attaching to Other Events

                          Adding New Elements

                          Removing Elements

                          Alternatives to Adding and Removing Elements

                  Controlling HTML5 Media

                  Summary

                  Self-Test Questions

         LESSON 17  Controlling Cookies and Local Storage

                  Using Cookies

                          Setting a Cookie

                          Reading a Cookie

                          Deleting a Cookie

                  Using Local Storage

                          Removing and Clearing Local Data

                  Summary

                  Self-Test Questions

         LESSON 18  Working with Different Browsers

                  The User Agent String

                          The GetBrowser() Function

                  The Query String

                          The GetQueryString() Function

                  Summary

                  Self-Test Questions

         LESSON 19  Implementing Interrupts and Timeouts

                  Using Interrupts

                          Using setTimeout()

                          Passing a String

                          Repeating Timeouts

                          Cancelling a Timeout

                  Using setInterval()

                          Using ShowTime()

                          Cancelling an Interval

                  A Simple Animation

                  Web Workers

                  Summary

                  Self-Test Questions

         LESSON 20  Using Ajax

                  Creating an Ajax Object

                  The PostAjaxRequest() Function

                  The GetAjaxRequest() Function

                  The callback() Function

                  The ajax.htm Example

                  The ajax.php Program

                  The ajax2.htm Example

                  Ajax Security Restrictions

                  The OnDOMReady() Function

                  Summary

                  Self-Test Questions

PART III    Appendixes


APPENDIX A  Answers to the Self-Test Questions

                  Lesson 1 Answers

                  Lesson 2 Answers

                  Lesson 3 Answers

                  Lesson 4 Answers

                  Lesson 5 Answers

                  Lesson 6 Answers

                  Lesson 7 Answers

                  Lesson 8 Answers

                  Lesson 9 Answers

                  Lesson 10 Answers

                  Lesson 11 Answers

                  Lesson 12 Answers

                  Lesson 13 Answers

                  Lesson 14 Answers

                  Lesson 15 Answers

                  Lesson 16 Answers

                  Lesson 17 Answers

                  Lesson 18 Answers

                  Lesson 19 Answers

                  Lesson 20 Answers

         APPENDIX B  Common JavaScript Functions

                  Arithmetic Functions

                  Array Functions

                  Boolean Functions

                  Date Functions

                  DOM Functions

                  Global Functions

                  Number Functions

                  Regular Expression Functions

                  String Functions

                  Window Functions

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.206.116