Home > Store

Sams Teach Yourself JavaScript in 24 Hours, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself JavaScript in 24 Hours, 3rd Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2002
  • Edition: 3rd
  • Book
  • ISBN-10: 0-672-32406-7
  • ISBN-13: 978-0-672-32406-2

JavaScript is one of the easiest, most straightforward ways to enhance a Web site with interactivity.

Sams Teach Yourself JavaScript in 24 Hours 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.

The Third Edition of Sams Teach Yourself JavaScript in 24 Hours includes material on the latest developments in JavaScript and Web scripting.

Readers will learn how to use JavaScript to enhance Web pages with interactive forms, objects, and cookies. They will also discover how to use JavaScript to work with games, animation, and multimedia.



The source code for the examples developed in the book in one ZIP file - 243 kb -- code.zip

The source code for the examples developed in the book in one SIT file - 320 kb -- code.sit.hqx

For updates and corrections to the code and/or book, please visit the author's book companion web site at http://www.jsworkshop.com.

Sample Content

Online Sample Chapters

Getting Data with Forms Using JavaScript

How JavaScript Programs Work

Using JavaScript to Work with Windows and Frames

Using JavaScript to Respond to Events

Working with JavaScript's Document Object Model

Table of Contents

(NOTE: Each chapter concludes with a Summary, Q&A, Quiz and Exercises.)


How to Use This Book. Q&A, Quiz, and Exercises. This Book's Web Site.


Hour 1. Understanding JavaScript.

Learning Web Scripting Basics. How JavaScript Fits into a Web Page. Browsers and JavaScript. Alternatives to JavaScript.

Hour 2. Creating a Simple Script.

Tools for Scripting. What Time is It? Beginning the Script. Adding JavaScript Statements. Creating Output. Adding the Script to a Web Page. Testing the Script. Workshop: Hiding Scripts from Older Browsers.

Hour 3. How JavaScript Programs Work.

Combining Tasks with Functions. Understanding Objects. Handling Events. Conditional Statements. Loops. Which Script Runs First? Workshop: Using Comments.


Hour 4. Using Functions and Variables.

Using Functions. Understanding Expressions and Operators. Using Variables. Data Types in JavaScript. Converting Between Data Types. Workshop: Storing User Data in Variables.

Hour 5. Using Strings and Arrays.

Using String Objects. Working with Substrings. Using Numeric Arrays. Using String Arrays. Sorting a Numeric Array. Workshop: Displaying a Scrolling Message.

Hour 6. Testing and Comparing Values.

The if Statement. Using Shorthand Conditional Expressions. Using Multiple Conditions with switch. Workshop: Evaluating a User Response.

Hour 7. Repeating Yourself: Using Loops. Using for Loops. Using while Loops. Using do…while Loops. Working with Loops. Using for…in loops. Workshop: Working with Arrays and Loops.
Hour 8. Using Math and Date Functions.

What Is an Object? The Math Object. Working with Dates. Workshop: Working with the Math Object.


Hour 9. Working with the Document Object Model.

Understanding the Document Object Model. Using window Objects. Working with Web Documents. Accessing Browser History. Working with the location Object. Reading Information about the Browser. Workshop: Creating Back and Forward Buttons.

Hour 10. Responding to Events.

Understanding Event Handlers. Using Mouse Events. Using Keyboard Events. Using the onLoad and onUnload Events. Workshop: Adding Link Descriptions to a Web Page.

Hour 11. Using Windows and Frames.

Controlling Windows with Objects. Moving and Resizing Windows. Using Timeouts. Displaying Dialog Boxes. Working with Frames. Workshop: Creating a Navigation Frame.

Hour 12. 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. Workshop: Validating a Form.

Hour 13. Using Graphics and Animation.

Using Image Maps with JavaScript. Using Dynamic Images in JavaScript. Creating Rollovers. Workshop: Creating a Simple Animation.


Hour 14. Creating Cross-Browser Scripts.

Reading Browser Information. Supporting Browsers with JavaScript. Supporting Non-JavaScript Browsers. Workshop: Scripting for Multiple Browsers.

Hour 15. Creating Custom Objects.

Using Objects to Simplify Scripting. Creating an Object Instance. Customizing Built-In Objects. Workshop: Storing Data in Objects.

Hour 16. Working with Sounds and Plug-Ins.

Introducing Plug-Ins. Working with Plug-In Objects. Workshop: Playing Music with the Mouse.

Hour 17. Debugging JavaScript Applications.

Avoiding Bugs. Basic Debugging Tools. Creating Error Handlers. Workshop: Debugging a Script.


Hour 18. 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. Workshop: Creating Dynamic Styles.

Hour 19. Using Dynamic HTML (DHTML).

Understanding DOM Structure. Creating Positionable Elements. Workshop: Creating Dynamic HTML Animation.

Hour 20. Using Advanced DOM Features.

Working with DOM Nodes. Hiding and Showing Objects. Modifying Text within a Page. Adding Text to a Page. Workshop: A Better Scrolling Message.


Hour 21. Improving a Web Page with JavaScript.

Creating the HTML Document. Using Drop-Down Lists for Navigation. Adding Link Descriptions. Adding Graphic Links. Workshop: Finishing up the Page.

Hour 22. Creating a JavaScript Game.

Planning the Program. Writing the Program. Workshop: Putting It All Together.

Hour 23. Creating DHTML Applications.

Creating a Dynamic Site Map. Creating Drop-Down Menus. Workshop: Creating a Scrolling Text Box.

Hour 24. JavaScript Tips and Tricks.

Learning Advanced JavaScript Techniques. Future Web Technologies. Planning for the Future. A few JavaScript Tips. Workshop: Using Cookies.


Appendix A. Other JavaScript Resources.

Other Books. JavaScript Web Sites. Web Site Development. Dynamic HTML Web Sites. CGI Resources. This Book's Web Site.

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.



Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership