SPECIAL OFFER
Use code BACKTOLEARN during checkout to save 50% on books, eBooks, & videos. Shop now.
Register your product to gain access to bonus material or receive a coupon.
JavaScript is one of the easiest, most straightforward ways to enhance a website with interactivity. Sams Teach Yourself JavaScript in 24 Hours, 4th Edition serves as an easy-to-understand tutorial on both scripting basics and JavaScript itself. The book is written in a clear and personable style with an extensive use of practical, complete examples. It also includes material on the latest developments in JavaScript and web scripting. You will learn how to use JavaScript to enhance web pages with interactive forms, objects, and cookies, as well as how to use JavaScript to work with games, animation, and multimedia.
Enrich Your HTML Tables with JavaScript Progressive Enhancement
JavaScript Progressive Enhancement in Practice
Getting Started with JavaScript Programming
Getting Started with JavaScript Programming
Contents at a Glance
Introduction
Part I: Introducing the Concept of Web Scripting and the JavaScript Language
Hour 1............................................................................... Understanding JavaScript
2 Creating Simple Scripts
3 Getting Started with JavaScript Programming
4 Working with the Document Object Model (DOM)
Part II: Learning JavaScript Basics
Hour 5............................................................ Using Variables, Strings, and Arrays
6 Using Functions and Objects
7 Controlling Flow with Conditions and Loops
8 Using Built-in Functions and Libraries
Part III: Learning More About the DOM
Hour 9..................................................................................... Responding to Events
10 Using Windows and Frames
11 Getting Data with Forms
12 Working with Style Sheets
13 Using the W3C DOM
14 Using Advanced DOM Features
Part IV: Working with Advanced JavaScript Features
Hour 15................................................................................. Unobtrusive Scripting
16 Debugging JavaScript Applications
17 AJAX: Remote Scripting
18 Greasemonkey: Enhancing the Web with JavaScript
Part V: Building Multimedia Applications with JavaScript
Hour 19................................................................ Using Graphics and Animation
20 Working with Sound and Plug-ins
Part VI: Creating Complex Scripts
Hour 21................................................... Building JavaScript Drop-down Menus
22 Creating a JavaScript Game
23 Creating JavaScript Applications
24 Your Future with JavaScript
Part VII: Appendixes
A Other JavaScript Resources
B Tools for JavaScript Developers
C Glossary
D JavaScript Quick Reference
E DOM Quick Reference
Index
Table of Contents
Part I: Introducing the Concept of Web Scripting and the JavaScript Language
Hour 1: Understanding JavaScript 7
Learning Web Scripting Basics.... 7
How JavaScript Fits into a Web Page... 9
Browsers and JavaScript
Specifying JavaScript Versions
JavaScript Beyond the Browser
Exploring JavaScript’s Capabilities
Alternatives to JavaScript
Hour 2: Creating Simple Scripts
Tools for Scripting
Displaying Time with JavaScript
Beginning the Script
Adding JavaScript Statements
Creating Output
Adding the Script to a Web Page
Testing the Script
Hour 3: Getting Started with JavaScript Programming
Basic Concepts
JavaScript Syntax Rules
Using Comments
Best Practices for JavaScript
Hour 4: Working with the Document Object Model (DOM)
Understanding the Document Object Model (DOM)
Using Window Objects
Working with Web Documents
Accessing Browser History
Working with the Location Object
Part II: Learning JavaScript Basics
Hour 5: Using Variables, Strings, and Arrays
Using Variables
Understanding Expressions and Operators
Data Types in JavaScript
Converting Between Data Types
Using String Objects
Working with Substrings
Using Numeric Arrays
Using String Arrays
Sorting a Numeric Array
Hour 6: Using Functions and Objects
Using Functions
Introducing Objects
Using Objects to Simplify Scripting
Extending Built-in Objects
Hour 7: Controlling Flow with Conditions and Loops
The if Statement
Using Shorthand Conditional Expressions
Testing Multiple Conditions with If and Else
Using Multiple Conditions with switch
Using for Loops
Using While Loops
Using Do…While Loops
Working with Loops
Looping Through Object Properties
Hour 8: Using Built-in Functions and Libraries
Using the Math Object
Working with Math Functions
Using the with Keyword
Working with Dates
Using Third-Party Libraries
Other Libraries
Part III: Learning More About the DOM
Hour 9: Responding to Events
Understanding Event Handlers
Using Mouse Events
Using Keyboard Events
Using the onLoad and onUnload Events
Hour 10: Using Windows and Frames
Controlling Windows with Objects
Moving and Resizing Windows
Using Timeouts
Displaying Dialog Boxes
Working with Frames
Hour 11: Getting Data with Forms
The Basics of HTML Forms
Using the Form Object with JavaScript
Scripting Form Elements
Displaying Data from a Form
Sending Form Results by Email
Hour 12: Working with Style Sheets
Style and Substance
Defining and Using CSS Styles
Using CSS Properties
Creating a Simple Style Sheet
Using External Style Sheets
Controlling Styles with JavaScript
Hour 13: Using the W.3C DOM
The DOM and Dynamic HTML
Understanding DOM Structure
Creating Positionable Elements (Layers)
Hour 14: Using Advanced DOM Features
Working with DOM Nodes
Hiding and Showing Objects
Modifying Text Within a Page
Adding Text to a Page
Part IV: Working with Advanced JavaScript Features
Hour 15: Unobtrusive Scripting
Scripting Best Practices
Reading Browser Information
Cross-Browser Scripting
Supporting Non-JavaScript Browsers
Hour 16: Debugging JavaScript Applications
Avoiding Bugs
Basic Debugging Tools
Creating Error Handlers
Advanced Debugging Tools
Hour 17: AJAX: Remote Scripting
Introducing AJAX
Using XMLHttpRequest
Creating a Simple AJAX Library
Creating an AJAX Quiz Using the Library
Debugging AJAX Applications
Hour 18: Greasemonkey: Enhancing the Web with JavaScript
Introducing Greasemonkey
Working with User Scripts
Creating Your Own User Scripts
Part V: Building Multimedia Applications with JavaScript
Hour 19: Using Graphics and Animation
Using Dynamic Images
Creating Rollovers
A Simple JavaScript Slideshow
Hour 20: Working with Sound and Plug-Ins
Introducing Plug-Ins
JavaScript and Flash
Playing Sounds with JavaScript
Testing Sounds in JavaScript
Part VI: Creating Complex Scripts
Hour 21: Building JavaScript Drop-Down Menus
Designing Drop-Down Menus
Scripting Drop-Down Menu Behavior
Hour 22: Creating a JavaScript Game
About the Game
Creating the HTML Document
Creating the Script
Adding Style with CSS
Hour 23: Creating JavaScript Applications
Creating a Scrolling Window
Style Sheet Switching with JavaScript
Hour 24: Your Future with JavaScript
Learning Advanced JavaScript Techniques
Future Web Technologies
Planning for the Future
Moving on to Other Languages
Part VII: Appendixes
Appendix A: Other JavaScript Resources
Other Books
JavaScript Websites
Web Development Sites
This Book’s Website
Appendix B: Tools for JavaScript Developers
HTML and Text Editors
HTML Validators
Debugging Tools
Appendix C: Glossary
Appendix D: JavaScript Quick Reference
Built-in Objects
Creating and Customizing Objects
JavaScript Statements
JavaScript Built-in Functions
Appendix E: DOM Quick Reference
DOM Level 0
DOM Level 1
Index