Sams Teach Yourself JavaScript in 21 Days


The aim of Sams Teach Yourself JavaScript in 21 Days is to tutor the Web-literate novice JavaScripter through to a high level of competency in applying JavaScript to Web pages.

In addition to core uses of client-side JavaScript, Sams Teach Yourself JavaScript in 21 Days also covers emerging topics such as the use of JavaScript with PDFs and the scripting of Scalable Vector Graphics (SVG).

The key principles taught throughout the book are backed...

See more details below
Other sellers (Paperback)
  • All (18) from $1.99   
  • New (5) from $20.13   
  • Used (13) from $1.99   
Sending request ...


The aim of Sams Teach Yourself JavaScript in 21 Days is to tutor the Web-literate novice JavaScripter through to a high level of competency in applying JavaScript to Web pages.

In addition to core uses of client-side JavaScript, Sams Teach Yourself JavaScript in 21 Days also covers emerging topics such as the use of JavaScript with PDFs and the scripting of Scalable Vector Graphics (SVG).

The key principles taught throughout the book are backed up with clear and useful examples. This enables the reader to easily apply what they¿ve learned with confidence in order to meet their own coding needs.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Whether JavaScript is your first language or your tenth, whether you’re building web doodads or e-commerce applications, this systematic, disciplined course will help you master the language with remarkable efficiency. And with some of the more egregious browser incompatibilities fading into memory, now’s a great time to learn JavaScript -- or to go beyond “snippet-stealing” to build real new functionality of your own.

Updated through version 1.5, Sams Teach Yourself JavaScript in 21 Days consists of 21 neatly organized one-hour lessons, plus a handy function reference. In the first several lessons, you’ll how to work with data, functions, statements, arrays, and JavaScript objects -- especially the Number and Math objects, and the String object, designed for capturing data entered on HTML forms. Next, there are detailed lessons on browser compatibility and checking; date/time manipulation; event handling; debugging and error handling; and DHTML/CSS. You’ll also find an excellent introduction to regular expressions, which enable you to perform a truly incredible array of web tasks, from cleaning content to validating email addresses.

Part III leverages your skills in real application building, from cookies to shopping carts, password protection to on-the-fly graphics with SVG. By the time you’re done, you’ll have the confidence to try just about anything. (Bill Camarda)

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780672322976
  • Publisher: Sams
  • Publication date: 4/29/2002
  • Series: Sams Teach Yourself Series
  • Edition number: 1
  • Pages: 755
  • Product dimensions: 7.40 (w) x 9.10 (h) x 1.80 (d)

Meet the Author

Andrew Watt is an independent consultant and author with expertise in XML and Web technologies including SVG. He is author of Designing SVG Web Graphics (New Riders) and XPath Essentials (Wiley). He is co-author of XML Schema Essentials (Wiley) and contributing author to XHTML, XML & Java 2 Platinum Edition (Que), Professional XSL, Professional XML 2nd Edition, and Professional XML Meta Data (Wrox).

Jonathan Watt has been working with JavaScript for two years and has been Webmaster of the Strathclyde University Skills Society Web site, as well as a number of his own Web sites such as His primary expertise is in the application of JavaScript in the client-side environment, but he also has used ASP and PHP to create database-driven Web sites. He is currently in the third year of a master's degree in engineering at Strathclyde.

Jinjer Simon has been actively involved in the computer industry for the past 17 years. Her involvement in the industry has included programming, providing software technical support, end-user training, developing written and online user documentation, creating software tutorials, developing Internet Web sites, and writing technical books. Jinjer and her husband currently live in Coppell, Texas, with their two children where she currently works as a consultant for MillenniSoft Inc. by providing Web site development and online documentation development.

Jim O'Donnell was born on October 17, 1963, in Pittsburgh, Pennsylvania (you may forward birthday greetings to After a number of unproductive years, he went to Rensselaer Polytechnic Institute for 11 years earning three degrees. He now lives in Washington, DC, and spends most of his time building spacecraft. He has been writing and editing books for eight years. When he isn't working, he collects comic books and PEZ dispensers and plays ice hockey for the DC Nationals. Go, Nats!

Read More Show Less

Table of Contents



Day 1. Getting the Basics Right.

Introducing JavaScript. JavaScript in Context. Selecting the Right Technology. JavaScript, Jscript, and ECMAScript. Let's Get Started. Data Types. Some Useful Tools.

Day 2. Working with Data.

Simple Data Storage. Operators. JavaScript Operators.

Day 3. Functions and Statements.

User Defined Functions. Predefined Global Functions. What Is a Statement? Control Statements. Loop Statements.

Day 4. JavaScript Is Object-Based.

Understanding Objects. Client-Side JavaScript Objects. The document Object. Environment Objects. Core JavaScript Objects. Exploring an Object.

Day 5. An Introduction to Arrays.

What Is an Array? Creating an Array. Accessing Arrays. Array Properties. Array Methods. Associative Arrays. Storing Objects in Array Elements.

Day 6. HTML Forms and the String Object.

Collecting Data from HTML Forms. Form Elements. The String Object. Checking User Input.

Day 7. Numbers and Math.

The Number Object. The Math Object. Predefined Properties. Methods of the Math Object. Creating Your Own Math Functions.


Day 8. The Browser Issue.

Different Browsers, Different JavaScript. Cross-Browser Compatible Scripting. The W3C DOM.

Day 9. Date and Time Manipulation.

JavaScript and Dates. The Date Object. Date Formatting. Time Formatting. Converting Date and Time Formats.

Day 10. Events and Event Handling.

Understanding Events. Creating an Event Handler. Types of Events. How to Handle Events.

Day 11. Dynamic HTML.

What is DHTML? Using Cascading Style Sheets. Working with Layers. Changing Attributes of an HTML Element. Moving Things

Day 12. Windows and Frames.

What Are Windows and Frames? Determining Window Location. Working with Window History. Working with the Status Line. Using the Screen Object. Working with Frames. Working with Popups.

Day 13. Regular Expressions Make It Easier.

Why Regular Expressions Are Useful. What Is a Regular Expression? Some Simple Patterns. Regular Expressions Overview. Defining Regular Expressions. Quantifiers. The Methods of the RegExp Object. The Properties of the RegExp Object.

Day 14. Advanced Array Management.

The Array Object's Methods. Multidimensional Arrays.


Day 15. Debugging and Error Handling.

Preventing and Classifying JavaScript Errors. Finding Syntax Errors. Debugging Load-Time Errors. Debugging Run-Time Errors I: Discrete Events. Debugging Run-Time Errors II: Continuous Events. Advanced Debugging Techniques. Using JavaScript Debuggers.

Day 16. Cookies: Storing Persistent Data.

Maintaining State. Cookies: An Introduction. Using Cookies. Other State Maintenance Options.

Day 17. Privacy and Security.

Privacy for Web Users. Privacy for Webmasters. Privacy Impact on JavaScript.

Day 18. Plugins and Applets.

Plugins Versus Applets. Detecting Plugin Installation. Working with Plugin Objects. Working with Applets.

Day 19. Creating Your Own Objects.

What Is a Custom Object? Use of the Constructor to Create Objects. Creating an Instance of a Custom Object. Creating Object Methods. Linking Objects Together.

Day 20. JavaScript in E-Commerce.

Requirements for an E-Commerce Site. Shop Structure. The Online Catalog. Shopping Carts.

Day 21. JavaScript and SVG.

Overview of Scalable Vector Graphics. Example SVG Code. The SVG Document Object Model. Using JavaScript in SVG. JavaScript Beyond Declarative Animation. Interaction Between the HTML and SVG DOM. Finding Out More About SVG.


Appendix A. New Features in JavaScript 1.5.

Number Formatting Additions. Runtime Error Messages. Regular Expressions. Conditional Function Declarations. Functions Can Be Declared Within an Expression. Multiple Catch Clauses.

Appendix B. Color Codes.

Color Names Specified as Plain-Language. Hexadecimal Color Value. RGB Color Values.

Appendix C. Functions Reference.

abs(). acos(). asin(). atan(). atan2(). atob(). Boolean(). btoa(). captureEvents(). catch(). ceil(). cos(). Date(). decodeURI(). decodeURIComponent(). encodeURI(). encodeURIComponent(). Error(). escape(). eval(). exp(). floor(). Function(). GetObject(). handleEvent(). isFinite(). isNaN(). log(). max(). min(). Number(). Object(). parseFloat(). parseInt(). pow(). random(). releaseEvents(). rgb(). round(). routeEvents(). ScriptEngine(). sin(). sqrt(). tan(). toString(). unescape(). unwatch(). watch().

Appendix D. Resources Online.

JavaScript. Java and Java Applets. HTML. CGI.

Appendix E. A Short History of JavaScript.


Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted November 15, 2005

    Quick Introduction to JavaScript

    Some programmers look down on the Sams Teach Yourself series as beneath their level. I imagine that some professional chefs also look down on a ham sandwhich. However, sometimes a ham sandwhich with cheese on rye really hits the spot. The Sam Teach Yourself series of books provide a practical and efficient way to get introduced to a new topic. The 'Sams Teach Yourself JavaScript in 21 Days' is no exception. With the emergence of AJAX as a cutting edge way to provide rich web based applications, the demand for a working knowledge of JavaScript will increase. 'Sams Teach Yourself JavaScript in 21 Days' goes step by step through the core aspects of JavaScript. This book teaches fundamentals such as variables, arrays, statements, functions, built-in methods, and basic objects. The book also teaches introductory DHTML and SVG manipulation--though some of it may seem out of date as the book was published three years ago. In general, the authors do a good job of explaining programming concepts and how JavaScript implements them. I found in a couple of cases where the code examples had errors. While I was able to work around the errors in the book, it's always frustrating when the example doesn't work. If you are a programmer who needs to implement JavaScript in your current project, 'Sams Teach Yourself JavaScript in 21 Days' will probably help you get up to speed quickly. Or if you are new to programming and need a step by step guide to a relatively easy language to use, you will find 'Sams Teach Yourself JavaScript in 21 Days' an easy to use and approachable book. If you are looking for a more advanced discussion of JavaScript, this book may disappoint you. You may want to consider O'Reilly's 'JavaScript: The Definitive Guide'.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)