Beginning JavaScript

Höfundur Jeremy McPeak

Útgefandi Wiley Professional Development (P&T)

Snið Page Fidelity

Print ISBN 9781118903339

Útgáfa 5

Útgáfuár 2015

3.490 kr.

Description

Efnisyfirlit

  • Beginning JavaScript®
  • CREDITS
  • ABOUT THE AUTHORS
  • ACKNOWLEDGMENTS
  • CONTENTS
  • INTRODUCTION
  • CHAPTER 1: INTRODUCTION TO JAVASCRIPT AND THE WEB
  • Introduction to JavaScript
  • What Is JavaScript?
  • JavaScript and the Web
  • What Can JavaScript Do for Me?
  • Tools Needed to Create JavaScript Web Applications
  • Development Tools
  • Web Browsers
  • Where Do My Scripts Go?
  • Linking to an External JavaScript File
  • Advantages of Using an External File
  • Your First Simple JavaScript Program
  • Writing More JavaScript
  • A Brief Look at Browsers and Compatibility Problems
  • Summary
  • CHAPTER 2: DATA TYPES AND VARIABLES
  • Types of Data in JavaScript
  • Numerical Data
  • Text Data
  • Boolean Data
  • Variables—Storing Data in Memory
  • Creating Variables and Giving Them Values
  • Assigning Variables with the Value of Other Variables
  • Using Data—Calculations and Basic String Manipulation
  • Numerical Calculations
  • Increment and Decrement Operators
  • Operator Precedence
  • Basic String Operations
  • Mixing Numbers and Strings
  • Data Type Conversion
  • Dealing with Strings That Won’t Convert
  • Arrays
  • A Multi-Dimensional Array
  • Summary
  • CHAPTER 3: DECISIONS AND LOOPS
  • Decision Making—The if and switch Statements
  • Comparison Operators
  • Precedence
  • Assignment versus Comparison
  • Assigning the Results of Comparisons
  • The if Statement
  • Logical Operators
  • AND
  • OR
  • NOT
  • Multiple Conditions Inside an if Statement
  • else and else if
  • Comparing Strings
  • The switch Statement
  • Executing the Same Code for Different Cases
  • Looping—The for and while Statements
  • The for Loop
  • The for…in Loop
  • The while Loop
  • The do…while loop
  • The break and continue Statements
  • Summary
  • CHAPTER 4: FUNCTIONS AND SCOPE
  • Creating Your Own Functions
  • Scope and Lifetime
  • Global Scope
  • Functional Scope
  • Identifier Lookup
  • Functions as Values
  • Summary
  • CHAPTER 5: JAVASCRIPT—AN OBJECT-BASED LANGUAGE
  • Object-Based Programming
  • What Are Objects?
  • Objects in JavaScript
  • Using JavaScript Objects
  • Creating an Object
  • Using an Object’s Properties
  • Calling an Object’s Methods
  • Primitives and Objects
  • JavaScript’s Native Object Types
  • String Objects
  • The length Property
  • Finding a String Inside Another String—The indexOf() and lastIndexOf() Methods
  • Copying Part of a String—The substr() and substring() Methods
  • Converting Case—The toLowerCase() and toUpperCase() Methods
  • Selecting a Single Character from a String—The charAt() and charCodeAt() Methods
  • Converting Character Codes to a String—The fromCharCode() Method
  • Removing Leading and Trailing Whitespace—The trim() Method
  • Array Objects
  • Finding Out How Many Elements Are in an Array—The length Property
  • Adding Elements—The push() Method
  • Joining Arrays—The concat() Method
  • Copying Part of an Array—The slice() Method
  • Converting an Array into a Single String—The join() Method
  • Putting Your Array in Order—The sort() Method
  • Putting Your Array into Reverse Order—The reverse() Method
  • Finding Array Elements—The indexOf() and lastIndexOf() Methods
  • Iterating through an Array without Loops
  • The Math Object
  • The abs() Method
  • Finding the Largest and Smallest Numbers—The min() and max() Methods
  • Rounding Numbers
  • The random() Method
  • The pow() Method
  • Number Objects
  • The toFixed() Method
  • Date Objects
  • Creating a Date Object
  • Getting Date Values
  • Setting Date Values
  • Calculations and Dates
  • Getting Time Values
  • Setting Time Values
  • Creating Your Own Custom Objects
  • Creating New Types of Objects (Reference Types)
  • Defining a Reference Type
  • Creating and Using Reference Type Instances
  • Summary
  • CHAPTER 6: STRING MANIPULATION
  • Additional String Methods
  • The split() Method
  • The replace() Method
  • The search() Method
  • The match() Method
  • Regular Expressions
  • Simple Regular Expressions
  • Regular Expressions: Special Characters
  • Text, Numbers, and Punctuation
  • Repetition Characters
  • Position Characters
  • Covering All Eventualities
  • Grouping Regular Expressions
  • Reusing Groups of Characters
  • The String Object
  • The split() Method
  • The replace() Method
  • The search() Method
  • The match() Method
  • Using the RegExp Object’s Constructor
  • Telephone Number Validation
  • Validating a Postal Code
  • Validating an E-mail Address
  • Validating a Domain Name
  • Validating a Person’s Address
  • Validating the Complete Address
  • Summary
  • CHAPTER 7: DATE, TIME, AND TIMERS
  • World Time
  • Setting and Getting a Date Object’s UTC Date and Time
  • Timers in a Web Page
  • One-Shot Timer
  • Setting a Timer that Fires at Regular Intervals
  • Summary
  • CHAPTER 8: PROGRAMMING THE BROWSER
  • Introduction to the Browser’s Objects
  • The window Object
  • The history Object
  • The location Object
  • The navigator Object
  • The geolocation Object
  • The screen Object
  • The document Object
  • Using the document Object
  • The images Collection
  • The links Collection
  • Determining the User’s Browser
  • Feature Detection
  • Browser Sniffing
  • Summary
  • CHAPTER 9: DOM SCRIPTING
  • The Web Standards
  • HTML
  • ECMAScript
  • The Document Object Model
  • The DOM Standard
  • Level 0
  • Level 1
  • Level 2
  • Level 3
  • Level 4
  • Browser Compliance with the Standards
  • Differences between the DOM and the BOM
  • Representing the HTML Document as a Tree Structure
  • What Is a Tree Structure?
  • An Example HTML Page
  • The Core DOM Objects
  • Base DOM Objects
  • High-Level DOM Objects
  • DOM Objects and Their Properties and Methods
  • The Document Object and its Methods
  • The Element Object
  • The Node Object
  • Manipulating the DOM
  • Accessing Elements
  • Changing Appearances
  • Using the style Property
  • Changing the class Attribute
  • Positioning and Moving Content
  • Example: Animated Advertisement
  • Are We There Yet?
  • Performing the Animation
  • Summary
  • CHAPTER 10: EVENTS
  • Types of Events
  • Connecting Code to Events
  • Handling Events via HTML Attributes
  • Handling Events via Object Properties
  • The Standard Event Model
  • Connecting Code to Events—The Standard Way
  • Using Event Data
  • Event Handling in Old Versions of Internet Explorer
  • Accessing the event Object
  • Using Event Data
  • Writing Cross-Browser Code
  • Native Drag and Drop
  • Making Content Draggable
  • Creating a Drop Target
  • Transferring Data
  • Summary
  • CHAPTER 11: HTML FORMS: INTERACTING WITH THE USER
  • HTML Forms
  • Traditional Form Object Properties and Methods
  • HTML Elements in Forms
  • Common Properties and Methods
  • The name Property
  • The value Property
  • The form Property
  • The type Property
  • The focus() and blur() Methods
  • Button Elements
  • Text Elements
  • The Text Box
  • Problems with Firefox and the blur Event
  • The Password Text Box
  • The Hidden Text Box
  • The textarea Element
  • Check Boxes and Radio Buttons
  • Selection Boxes
  • Adding and Removing Options
  • Adding New Options with Standard Methods
  • Select Element Events
  • HTML5 Form Object Properties and Methods
  • New Input Types
  • New Elements
  • The Element
  • The and Elements
  • Summary
  • CHAPTER 12: JSON
  • XML
  • JSON
  • Simple Values
  • Objects
  • Arrays
  • Serializing Into JSON
  • Parsing JSON
  • Summary
  • CHAPTER 13: DATA STORAGE
  • Baking Your First Cookie
  • A Fresh-Baked Cookie
  • Viewing Cookies in Internet Explorer
  • Viewing Cookies in Firefox
  • Viewing Cookies in Chrome
  • The Cookie String
  • name and value
  • expires
  • path
  • domain
  • secure
  • Creating a Cookie
  • Getting a Cookie’s Value
  • Cookie Limitations
  • A User May Disable Cookies
  • Number and Information Limitation
  • Cookie Security and IE
  • Web Storage
  • Setting Data
  • Getting Data
  • Removing Data
  • Storing Data as Strings
  • Viewing Web Storage Content
  • Summary
  • CHAPTER 14: AJAX
  • What Is Ajax?
  • What Can It Do?
  • Google Maps
  • Google Suggest
  • Browser Support
  • Using the XMLHttpRequest Object
  • Creating an XMLHttpRequest Object
  • Using the XMLHttpRequest Object
  • Asynchronous Requests
  • Creating a Simple Ajax Module
  • Planning the HttpRequest Module
  • The HttpRequest Constructor
  • Creating the send() Method
  • The Full Code
  • Validating Form Fields with Ajax
  • Requesting Information
  • The Received Data
  • Before You Begin
  • A Web Server
  • PHP
  • Things to Watch Out For
  • Security Issues
  • The Same-Origin Policy
  • CORS
  • Usability Concerns
  • The Browser’s Back Button
  • Creating a Back/Forward-Capable Form with an IFrame
  • The Server Response
  • Dealing with Delays
  • Degrade Gracefully When Ajax Fails
  • Summary
  • CHAPTER 15: HTML5 MEDIA
  • A Primer
  • Scripting Media
  • Methods
  • Properties
  • Events
  • Summary
  • CHAPTER 16: JQUERY
  • Getting jQuery
  • jQuery’s API
  • Selecting Elements
  • Changing Style
  • Adding and Removing CSS Classes
  • Toggling Classes
  • Checking if a Class Exists
  • Creating, Appending, and Removing Elements
  • Creating Elements
  • Appending Elements
  • Removing Elements
  • Handling Events
  • The jQuery Event Object
  • Rewriting the Tab Strip with jQuery
  • Using jQuery for Ajax
  • Understanding the jQuery Function
  • Automatically Parsing JSON Data
  • The jqXHR Object
  • Summary
  • CHAPTER 17: OTHER JAVASCRIPT LIBRARIES
  • Digging into Modernizr
  • Getting Modernizr
  • Modernizr’s API
  • Custom Tests
  • Loading Resources
  • Diving into Prototype
  • Getting Prototype
  • Testing Your Prototype Installation
  • Retrieving Elements
  • Selecting Elements with CSS Selectors
  • Performing an Operation on Elements Selected with $$()
  • Manipulating Style
  • Creating, Inserting, and Removing Elements
  • Creating an Element
  • Adding Content
  • Removing an Element
  • Using Events
  • Rewriting the Tab Strip with Prototype
  • Using Ajax Support
  • Delving into MooTools
  • Getting MooTools
  • Testing Your MooTools Installation
  • Finding Elements
  • Selecting Elements with CSS Selectors
  • Performing Operations on Elements
  • Changing Style
  • Creating, Inserting, and Removing Elements
  • Using Events
  • Rewriting the Tab Strip with MooTools
  • Ajax Support in MooTools
  • Summary
  • CHAPTER 18: COMMON MISTAKES, DEBUGGING, AND ERROR HANDLING
  • D’oh! I Can’t Believe I Just Did That: Some Common Mistakes
  • Undefined Variables
  • Case Sensitivity
  • Incorrect Number of Closing Braces
  • Incorrect Number of Closing Parentheses
  • Using Equals (=) Rather than Equality (==)
  • Using a Method as a Property and Vice Versa
  • Missing Plus Signs during Concatenation
  • Error Handling
  • Preventing Errors
  • The try…catch Statements
  • Throwing Errors
  • Nested try…catch Statements
  • finally Clauses
  • Debugging
  • Debugging in Chrome (and Opera)
  • Setting Breakpoints
  • Scope Variables and Watches
  • Stepping through Code
  • The Console
  • Call Stack Window
  • Debugging in Internet Explorer
  • Setting Breakpoints
  • Adding Watches
  • Stepping through Code
  • The Console
  • Debugging in Firefox with Firebug
  • Setting Breakpoints
  • Watches
  • Stepping through Code
  • The Console
  • Debugging in Safari
  • Setting Breakpoints
  • Adding Watches
  • Stepping through Code
  • The Console
  • Summary
  • APPENDIX A: ANSWERS TO EXERCISES
  • APPENDIX B: JAVASCRIPT CORE REFERENCE
  • APPENDIX C: W3C DOM REFERENCE
  • APPENDIX D: LATIN-1 CHARACTER SET
  • INDEX
  • ADVERT
  • EULA

Additional information

Veldu vöru

Rafbók til eignar

Aðrar vörur

0
    0
    Karfan þín
    Karfan þín er tómAftur í búð