The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks


Using a cookbook approach, The JavaScript Anthology will show you how to apply JavaScript to solve over 101 common Web Development challenges. You'll discover how-to:

  • Optimize your code so that it runs faster
  • Create Ajax applications with the XmlHttpRequest object
  • ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (31) from $1.99   
  • New (5) from $15.08   
  • Used (26) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2014

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

2006 Paperback New

Ships from: san francisco, CA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2009

Feedback rating:


Condition: New
0975240269 *BRAND NEW* Ships Same Day or Next!

Ships from: Springfield, VA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2005

Feedback rating:


Condition: New
Paperback New (3215) Paperback, 1st edition 2006; Great condition!

Ships from: Bethesda, MD

Usually ships in 1-2 business days

  • Canadian
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2015

Feedback rating:


Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2008

Feedback rating:


Condition: New

Ships from: Chicago, IL

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Sort by
Sending request ...


Using a cookbook approach, The JavaScript Anthology will show you how to apply JavaScript to solve over 101 common Web Development challenges. You'll discover how-to:

  • Optimize your code so that it runs faster
  • Create Ajax applications with the XmlHttpRequest object
  • Validate web forms to improve usability
  • Take control of your web pages with the DOM
  • Ensure that your JavaScript code is accessible
  • Create slick drop-down menu systems

Included in this book is extensive coverage of DHTML and Ajax, including how-to create and customize advanced effects such as draggable elements, dynamically sorting data in a Web Browser, advanced menu systems, retrieving data from a Web Server using XMLHttpRequest and more.

The JavaScript Anthology also includes extensive coverage of object oriented coding, efficient script design, accessibility, and cross-browser issues. Best of all, you'll get download access to all the code used in the book, so you can put the scripts to use instantly.

From the Publisher

"Take control with the ultimate JavaScript toolkit"

The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks provides you with tried and tested real-world solutions to over 100 real-world scripting problems.

Among the 101 Tips, Tricks & Hacks you'll learn how-to:

  • Search and replace text using regular expressions.
  • Navigate the DOM and create, delete, and move elements on the page.
  • Validate email addresses on your web forms.
  • Print inline error messages when validating forms.
  • Minimize the problems associated with popup windows.
  • Make a slideshow of images.
  • Ensure your code works on different browsers.
  • Make a style sheet switcher.
  • Build an accessible drop-down menu system.
  • Construct drag 'n' drop interfaces using AJAX.
  • Use JavaScript and Flash together.
  • Make your JavaScript accessible: an in-depth look at minimizing the accessibility problems associated with using JavaScript.
  • Use the XMLHttpRequest object to build AJAX applications.
  • Optimize your JavaScript code so that it runs faster.
  • And much more!

Who Should Read This Book?

If you're using JavaScript on your projects right now, and you want to do things faster and better, this book is for you. The JavaScript Anthology will save you the frustration of hunting down code on the Web only to find that it isn't customizable, and doesn't represent best practice or work across different browsers.

The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks contains thoroughly tested, cross-browser code that you can easily modify to suit your own needs.

The book is written in the usual SitePoint style: it's clear and fun to read, with plenty of example code that you can apply immediately to your own web sites. Plus, it's super-easy to navigate the book to find exactly what you want thanks to its cookbook approach and professionally-produced index. It's the perfect reference book.

There's no need to re-type any of the code in the book. As always, customers receive instant download access to all the files used in the book, so you can apply them immediately to your own projects.

Using a cookbook approach, The "JavaScript Anthology" shows how to apply JavaScript to solve a multitude of common Web Development challenges.

Read More Show Less

Product Details

  • ISBN-13: 9780975240267
  • Publisher: SitePoint Pty, Limited
  • Publication date: 2/28/2006
  • Edition number: 1
  • Pages: 592
  • Product dimensions: 7.04 (w) x 8.98 (h) x 1.30 (d)

Meet the Author

Cameron Adams is an author of multiple web development books and is often referred to as a "Web Technologist." In addition to his extensive JavaScript experience, Cameron's passions extend to CSS, PHP, and graphic design.

JAMES EDWARDS is a Nortel Networks Certified Support Specialist (NNCSS) in VPN Routers. His experience includes work with some of Nortel's largest enterprise customers.

RICHARD BRAMANTE, also a Nortel Networks Certified Support Specialist (NNCSS), has been in Nortel VPN Router support for three years, and was a technology lead on the Instant Internet.

AL MARTIN is a technical writer with 15 years of experience in electro-mechanical and computer-related disciplines.

Read More Show Less

Table of Contents

Who Should Read this Book?;
What’s in this Book?;
The Book’s Web Site;
The SitePoint Forums;
The SitePoint Newsletters;
Your Feedback;
Chapter 1: Getting Started with JavaScript;
1.1 JavaScript Defined;
1.2 JavaScript’s Limitations;
1.3 JavaScript Best Practices;
1.4 Providing for Users who Don’t Have JavaScript (Progressive Enhancement);
1.5 Separating Content from Behavior (Unobtrusive Scripting);
1.6 Using Braces and Semicolons (Consistent Coding Practice);
1.7 Adding a Script to a Page;
1.8 Getting Multiple Scripts to Work on the Same Page;
1.9 Hiding JavaScript Source Code;
1.10 Debugging a Script;
1.11 Strict Warnings;
1.12 Summary;
Chapter 2: Working with Numbers;
2.1 Doing Math with JavaScript;
2.2 Rounding a Number to x Decimal Places;
2.3 Creating and Constraining Random Numbers;
2.4 Converting a Number to a String;
2.5 Formatting Currency Values;
2.6 Converting a String to a Number;
2.7 Converting Numbers to Ordinals (-st, -nd, -rd, -th);
2.8 Summary;
Chapter 3: Working with Strings;
3.1 Including a Special Character in a String;
3.2 Transforming the Character Case of a String;
3.3 Encoding a URL;
3.4 Comparing Two Strings;
3.5 Finding a Substring within a String;
3.6 Splitting a String into Substrings;
3.7 Creating a Regular Expression;
3.8 Testing whether a String Matches a Regular Expression;
3.9 Testing whether a String Contains Only Numeric Data;
3.10 Testing whether a String is a Valid Phone Number;
3.11 Testing whether a String is a Valid Email Address;
3.12 Searching and Replacing Text using a Regular Expression;
3.13 Summary;
Chapter 4: Working with Arrays;
4.1 Using Array-literals;
4.2 Creating an Array of Arrays;
4.3 Indexing an Array with Strings Instead of Numbers;
4.4 Turning an Array into a String;
4.5 Adding or Removing Members from an Array;
4.6 Sorting an Array into Alphabetical or Numeric Order;
4.7 Sorting a Multi-dimensional Array;
4.8 Sorting an Array Randomly;
4.9 Summary;
Chapter 5: Navigating the Document Object Model;
5.1 Accessing Elements;
5.2 Creating Elements and Text Nodes;
5.3 Changing the Type of an Element;
5.4 Removing an Element or Text Node;
5.5 Reading and Writing the Attributes of an Element;
5.6 Getting all Elements with a Particular Attribute Value;
5.7 Adding and Removing Multiple Classes to/from an Element;
5.8 Summary;
Chapter 6: Processing and Validating Forms;
6.1 Reading and Writing the Data in a Text Field;
6.2 Reading and Setting the State of a Checkbox;
6.3 Reading and Setting the State of a Radio Button;
6.4 Reading and Setting the Value of a Select Box;
6.5 Validating a Mandatory Text Field;
6.6 Validating a Numeric Field;
6.7 Validating an Email Address Field;
6.8 Checking for Unselected Radio Buttons;
6.9 Stopping a Form Being Submitted Unless all its Fields are Valid;
6.10 Validating a Form with an Unknown Number of Fields;
6.11 Printing Inline Error Messages when Validating a Form;
6.12 Making Form Fields Appear or Disappear, Based on the Value of other Fields;
6.13 Summary;
Chapter 7: Working with Windows and Frames;
7.1 Using Popup Windows;
7.2 Opening Off-site Links in a New Window;
7.3 Communicating Between Frames;
7.4 Getting the Scrolling Position;
7.5 Making the Page Scroll to a Particular Position;
7.6 Getting the Viewport Size (the Available Space inside the Window);
7.7 Summary;
Chapter 8: Working with Cookies;
8.1 Writing Cookies;
8.2 Reading a Cookie;
8.3 Setting a Cookie to Expire at a Specific Date and Time;
8.4 Making a Cookie Accessible Only from a Specific Domain or Path;
8.5 Circumventing Browser Restrictions on the Number of Cookies you can Use;
8.6 Summary;
Chapter 9: Working with Dates and Times;
9.1 Getting the Date and Time;
9.2 Formatting a Date into a Sentence;
9.3 Formatting the Time into a 12- or 24-hour Clock;
9.4 Comparing Two Dates;
9.5 Formatting the Difference Between Dates;
9.6 Summary;
Chapter 10: Working with Images;
10.1 Preloading Images;
10.2 Swapping One Image for Another;
10.3 Displaying an Image at Random;
10.4 Making a Slideshow of Several Images;
10.5 Making an Image Fade in or out;
10.6 Making an Image-based Clock that Updates in Real Time;
10.7 Making a Progress Indicator;
10.8 Summary;
Chapter 11: Detecting Browser Differences;
11.1 Identifying Support for a Particular Feature;
11.2 Identifying a Particular Browser;
11.3 Detecting Quirks Mode and Standards Mode;
11.4 Summary;
Chapter 12: Using JavaScript with CSS;
12.1 Changing the Style of a Single Element;
12.2 Changing the Style of a Group of Elements;
12.3 Retrieving the Computed Style of an Element;
12.4 Making a Style Sheet Switcher;
12.5 Making a Style Sheet Switcher that Handles Multiple Media Types;
12.6 Reading and Modifying an Existing Style Sheet;
12.7 Adding New Style Sheet Rules;
12.8 Deleting a Rule from a Style Sheet;
12.9 Creating a New Style Sheet;
12.10 Summary;
Chapter 13: Basic Dynamic HTML;
13.1 Handling Events;
13.2 Finding the Size of an Element;
13.3 Finding the Position of an Element;
13.4 Detecting the Position of the Mouse Cursor;
13.5 Displaying a Tooltip when you Mouse Over an Element;
13.6 Sorting Tables by Column;
13.7 Summary;
Chapter 14: Time and Motion;
14.1 Using setTimeout and setInterval;
14.2 Making an Object Move Along a Set Path;
14.3 Making Animation Less Jerky;
14.4 Implementing Drag-and-drop Behavior;
14.5 Reordering a List Using Drag-and-drop Functionality;
14.6 Making a Scrolling News Ticker;
14.7 Creating Clip-based Transition Effects;
14.8 Making a Slider Control;
14.9 Summary;
Chapter 15: DHTML Menus and Navigation;
15.1 Making a Drop-down or Fly-out Menu;
15.2 Adding Arrows to Indicate the Presence of a Submenu;
15.3 Adding Timers so the Menus Don’t Open and Close so Abruptly;
15.4 Making Sure the Menus Stay Inside the Window;
15.5 Making the Menus Display Over select Elements;
15.6 Making a Folder Tree or Expanding Menu;
15.7 Indicating Expanded Branches in a Menu;
15.8 Allowing Only One Menu Branch to Be Open at Any Time;
15.9 Opening the Current Sub-branch Automatically;
15.10 Summary;
Chapter 16: JavaScript and Accessibility;
16.1 Is JavaScript Inaccessible?;
16.2 Making Scripts Accessible to the Keyboard;
16.3 Using Device-independent Event Handlers;
16.4 Making Scripts Accessible to the Keyboard as well as the Mouse;
16.5 Making title Attribute Tooltips Display on Focus;
16.6 Making a DHTML Menu Accessible to the Keyboard;
16.7 Making a DHTML Menu Usable via the Keyboard;
16.8 Making a DHTML Slider Control Accessible to the Keyboard;
16.9 Making Scripts Accessible to Screen Readers;
16.10 Summary;
Chapter 17: Using JavaScript with Flash;
17.1 Detecting whether Flash is Installed in a Browser;
17.2 Communicating Between JavaScript and Flash;
17.3 Summary;
Chapter 18: Building Web Applications with JavaScript;
18.1 Retrieving Data Using XMLHttpRequest;
18.2 Retrieving Data without Using XMLHttpRequest;
18.3 Creating Custom Dialogs (Such as Popup Forms);
18.4 Creating Editable Elements;
18.5 Controlling Text Selections;
18.6 Creating an Auto-complete Text Field;
18.7 Summary;
Chapter 19: Object Orientation in JavaScript;
19.1 What’s so Good about Object Orientation?;
19.2 Object Based Code vs Object Oriented Code;
19.3 Writing an Object Oriented Script;
19.4 Creating Methods for an Object;
19.5 Modelling Inheritance;
19.6 Understanding Scope;
19.7 Implementing Namespaces;
19.8 Summary;
Chapter 20: Keeping up the Pace;
20.1 Making Scripts Run Faster;
20.2 Writing Scripts Using Less Code;
20.3 Optimizing Scripts for the Web;
20.4 Avoiding Memory Leaks;
20.5 Making Scripts Run Before the Load Event;
20.6 Summary;

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 all of 2 Customer Reviews
  • Anonymous

    Posted June 4, 2006


    Are you involved or interested in building web sites or web applications? If you are, then this book is for you! Authors Cameron Adams and James Edwards, have done an outstanding job of writing a practical book for webmasters who are looking for a copy-and-paste solutions to everyday needs. Adams and James Edwards, begin by providing an overview of JavaScript's capabilities and limitations, and introduce some core best practices that they'll be using through the rest of the book. Then, the authors look at techniques for using and processing numbers in JavaScript. They continue by looking at ways of manipulating strings to find information, storing data, and preparing test for output as well as, including a thorough introduction to regular expressions in JavaScript. Next, the authors introduce you to one of the most powerful data-storage structures in JavaScript: the array. Then, the authors introduce and explore DOM, and look at how to create and read the data from elements, attributes, and text. Then, they look at reading and writing data from different kinds of form widget, address the tasks of validating and processing form data, and discuss techniques for improving the usability of form-based interfaces. They also take a cautious look at manipulating windows and scripting across frames. Next, the authors introduce cookies and show you how to use them effectively. Then, they show you how to get the date and time in JavaScript, how to compare and process dates and times, and how to output the final data in different formats and conventions. They continue by exploring the basic techniques involved in scripting for images. Next, the authors outline techniques for dealing with different browsers and rendering modes. Then, they look at how to read and write the styles from a single element or group of elements, how to read and write CSS rules to an existing or created style sheet, and how to build a style sheet switcher. The authors also cover event-handling in all its flavors, detecting the position and size of an object, tracking the mouse, and making elements appear and disappear. Next, they look at more complex forms of scripting that use motion and animation. Then, the authors include solutions for the problem of menus overlapping select elements in Windows IE 5 and IE 6. They also provide an overview of the current state of play regarding JavaScript and accessibility. The authors continue by showing you how to detect whether a user has the Flash plugin, and mastering communications between JavaScript and Flash. Next, they delve into the exciting area of online application design, including data retrieved using XMLHttpRequest, as well as the older technique of using iframes. Then, the authors introduce OOP, exploring its core concepts and benefits. Finally, the authors look at everyday techniques for writing faster, more efficient code that's shorter and uses less memory. In this most excellent book, you'll find scripts and discussions that sit on the bleeding edge of current practice. More importantly, you'll find this book a useful and inspirational resource for modern, best practice scripting.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 16, 2008

    No text was provided for this review.

Sort by: Showing all of 2 Customer Reviews

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