Home > General > JavaScript Cookbook
21%
JavaScript Cookbook

JavaScript Cookbook

          
5
4
3
2
1

Out of Stock


Premium quality
Premium quality
Bookswagon upholds the quality by delivering untarnished books. Quality, services and satisfaction are everything for us!
Easy Return
Easy return
Not satisfied with this product! Keep it in original condition and packaging to avail easy return policy.
Certified product
Certified product
First impression is the last impression! Address the book’s certification page, ISBN, publisher’s name, copyright page and print quality.
Secure Checkout
Secure checkout
Security at its finest! Login, browse, purchase and pay, every step is safe and secured.
Money back guarantee
Money-back guarantee:
It’s all about customers! For any kind of bad experience with the product, get your actual amount back after returning the product.
On time delivery
On-time delivery
At your doorstep on time! Get this book delivered without any delay.
Notify me when this book is in stock
Add to Wishlist

About the Book

Why reinvent the wheel every time you run into a problem with JavaScript? This cookbook is chock-full of code recipes that address common programming tasks, as well as techniques for building web apps that work in any browser. Just copy and paste the code samples into your project -- you’ll get the job done faster and learn more about JavaScript in the process.

You'll also learn how to take advantage of the latest features in ECMAScript 5 and HTML5, including the new cross-domain widget communication technique, HTML5's video and audio elements, and the drawing canvas. You'll find recipes for using these features with JavaScript to build high-quality application interfaces.

    >Create interactive web and desktop applications
  • Work with JavaScript objects, such as String, Array, Number, and Math
  • Use JavaScript with Scalable Vector Graphics (SVG) and the canvas element
  • Store data in various ways, from the simple to the complex
  • Program the new HTML5 audio and video elements
  • Implement concurrent programming with Web Workers
  • Use and create jQuery plug-ins
  • Use ARIA and JavaScript to create fully accessible rich internet applications

About the Author
Shelley Powers has been working with and writing about web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 15 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado.

Table of Contents
Chapter 1 Working with JavaScript Strings
    • Introduction
    • Concatenating Two or More Strings
    • Concatenating a String and Another Data Type
    • Conditionally Comparing Strings
    • Finding a Substring in a String
    • Extracting a Substring from a String
    • Checking for an Existing, Nonempty String
    • Breaking a Keyword String into Separate Keywords
    • Inserting Special Characters
    • Processing Individual Lines of a textarea
    • Trimming Whitespace from the Ends of a String
    • Left- or Right-Pad a String
Chapter 2 Using Regular Expressions
    • Introduction
    • Testing Whether a Substring Exists
    • Testing for Case-Insensitive Substring Matches
    • Validating a Social Security Number
    • Finding and Highlighting All Instances of a Pattern
    • Replacing Patterns with New Strings
    • Swap Words in a String Using Capturing Parentheses
    • Using Regular Expressions to Trim Whitespace
    • Replace HTML Tags with Named Entities
    • Searching for Special Characters
Chapter 3 Dates, Time, and Timers
    • Introduction
    • Printing Out Today’s Date
    • Printing Out the UTC Date and Time
    • Printing Out an ISO 8601 Formatted Date
    • Converting an ISO 8601 Formatted Date to a Format Acceptable to the Date Object
    • Creating a Specific Date
    • Scheduling a Future Date
    • Tracking Elapsed Time
    • Creating a Timeout
    • Creating Recurring Timers
    • Using Function Closures with Timers
Chapter 4 Working with Numbers and Math
    • Introduction
    • Keeping an Incremental Counter
    • Converting a Decimal to a Hexadecimal Value
    • Creating a Random Number Generator
    • Randomly Generating Colors
    • Converting Strings in a Table to Numbers
    • Summing All Numbers in a Table Column
    • Converting Between Degrees and Radians
    • Find the Radius and Center of a Circle to Fit Within a Page Element
    • Calculating the Length of a Circular Arc
Chapter 5 Working with Arrays and Loops
    • Introduction
    • Looping Through an Array
    • Creating a Multidimensional Array
    • Creating a String from an Array
    • Sorting an Array
    • Store and Access Values in Order
    • Store and Access Values in Reverse Order
    • Create a New Array as a Subset of an Existing Array
    • Searching Through an Array
    • Flatten a Multidimensional Array
    • Search and Remove or Replace Array Elements
    • Applying a Function Against Each Array Element
    • Applying a Function to Every Element in an Array and Returning a New Array
    • Creating a Filtered Array
    • Validating Array Contents
    • Using an Associative Array to Store Form Element Names and Values
Chapter 6 Building Reusability with JavaScript Functions
    • Introduction
    • Creating a Block of Reusable Code
    • Passing Single Data Values to and from a Function
    • Passing Complex Data Objects to a Function
    • Creating a Dynamic Runtime Function
    • Passing a Function As an Argument to Another Function
    • Implementing a Recursive Algorithm
    • Create a Function That Remembers Its State
    • Improving Application Performance with a Generalized Currying Function
    • Improve Application Performance with Memoization (Caching Calculations)
    • Using an Anonymous Function to Wrap Global Variables
Chapter 7 Handling Events
    • Introduction
    • Detecting When the Page Has Finished Loading
    • Capturing the Location of a Mouse Click Event Using the Event Object
    • Creating a Generic, Reusable Event Handler Function
    • Canceling an Event Based on Changed Circumstance
    • Preventing an Event from Propagating Through a Set of Nested Elements
    • Capturing Keyboard Activity
    • Using the New HTML5 Drag-and-Drop
    • Using Safari Orientation Events and Other Mobile Development Environments
Chapter 8 Browser Pieces
    • Introduction
    • Ask the Web Page Reader to Confirm an Action
    • Creating a New, Stripped-Down Browser Window
    • Finding Out About the Browser Accessing the Page
    • Warning the Web Page Reader About Leaving a Page
    • Changing Stylesheets Depending on Color Support
    • Modifying Image Dimensions Depending on Page Size
    • Creating Breadcrumbs in a CMS Template Page
    • Bookmarking a Dynamic Page
    • Preserving State for Back Button, Page Refresh
Chapter 9 Form Elements and Validation
    • Introduction
    • Accessing Form Text Input Values
    • Dynamically Disabling and Enabling Form Elements
    • Getting Information from a Form Element Based on an Event
    • Performing an Action When a Radio Button Is Clicked
    • Checking for a Valid Phone Number
    • Canceling a Form Submission
    • Preventing Duplicate Form Submissions
    • Hiding and Displaying Form Elements
    • Modifying a Selection List Based on Other Form Decisions
Chapter 10 Debugging and Error Handling
    • Introduction
    • Gracefully Handling No JavaScript Support
    • Checking for Errors in Functions
    • Using an Alert for Simple Debugging
    • Catching an Error and Providing Graceful Error Handling
    • Initiating Manageable Errors
    • Using Firebug with Firefox
    • Setting a Breakpoint and Examining Data with Firebug
    • Firefox and the Console
    • Using IE’s Built-in Debugger
    • Setting a Breakpoint with IE Developer Tools
    • Opera’s Dragonfly
    • Setting a Breakpoint with Dragonfly
    • Turning on Safari’s Development Tools
    • Setting a Breakpoint with Safari’s Debugger
    • Debugging in Chrome
Chapter 11 Accessing Page Elements
    • Introduction
    • Access a Given Element and Find Its Parent and Child Elements
    • Accessing All Images in the Web Page
    • Discover All Images Within an Article
    • Discover all Images in Articles Using the Selectors API
    • Finding the Parent Element for a Group of Elements
    • Highlighting the First Paragraph in Every Element
    • Apply a Striping Theme to an Unordered List
    • Creating an Array of All Elements of a Given Class
    • Finding All Elements That Share an Attribute
    • Finding All Checked Options
    • Summing All the Values in a Table Row
    • Get Element Attributes
    • Get Style Information for an Element
Chapter 12 Creating and Removing Elements and Attributes
    • Introduction
    • Using innerHTML: A Quick and Easy Approach to Adding Content
    • Inserting Elements Before Existing Page Elements
    • Appending a New Element to the End of a Page
    • Triggering Older Versions of IE to Style New Elements
    • Inserting a New Paragraph
    • Adding Text to a New Paragraph
    • Adding Attributes to an Existing Element
    • Testing for a Boolean Attribute
    • Removing an Attribute
    • Moving a Paragraph
    • Replacing Links with Footnote Bullets
    • Adding Rows to an Existing Table
    • Removing a Paragraph from a div Element
    • Deleting Rows from an HTML Table
    • Changing the Element’s CSS Style Properties
Chapter 13 Working with Web Page Spaces
    • Introduction
    • Determining the Area of the Web Page
    • Measuring Elements
    • Locating Elements in the Page
    • Hiding Page Sections
    • Creating Collapsible Form Sections
    • Adding a Page Overlay
    • Creating Tab Pages
    • Creating Hover-Based Pop-up Info Windows
    • Collapsing or Resizing the Sidebar
Chapter 14 Creating Interactive and Accessible Effects with JavaScript, CSS, and ARIA
    • Introduction
    • Displaying a Hidden Page Section
    • Creating an Alert Message
    • Highlighting Form Field with Missing or Incorrect Data
    • Adding Keyboard Accessibility to a Page Overlay
    • Creating Collapsible Form Sections
    • Displaying a Flash of Color to Signal an Action
    • Adding ARIA Attributes to a Tabbed Page Application
    • Live Region
Chapter 15 Creating Media Rich and Interactive Applications
    • Introduction
    • Creating Basic Shapes in Canvas (Using the canvas Element)
    • Implementing Canvas Applications in IE
    • Creating a Dynamic Line Chart in Canvas
    • Adding JavaScript to an SVG File
    • Accessing SVG from Web Page Script
    • Emulating SVG in Internet Explorer
    • Enable Interactive SVG Embedded in HTML
    • Using the Math Functions to Create a Realistic, Ticking Analog Clock in SVG
    • Integrating SVG and the Canvas Element in HTML
    • Turning on WebGL Support in Firefox and WebKit/Safari
    • Running a Routine When an Audio File Begins Playing
    • Controlling Video from JavaScript with the video Element
Chapter 16 JavaScript Objects
    • Introduction
    • Defining a Basic JavaScript Object
    • Keeping Object Members Private
    • Expanding Objects with prototype
    • Adding Getter/Setter to Objects
    • Inheriting an Object’s Functionality
    • Extending an Object by Defining a New Property
    • Enumerating an Object’s Properties
    • Preventing Object Extensibility
    • Preventing Object Additions and Changes to Property Descriptors
    • Preventing Any Changes to an Object
    • One-Off Objects and Namespacing Your JavaScript
    • Rediscovering “this” with Prototype.bind
    • Chaining Your Object’s Methods
Chapter 17 JavaScript Libraries
    • Introduction
    • Packaging Your Code
    • Testing Your Code with JsUnit
    • Minify Your Library
    • Hosting Your Library
    • Using an External Library: Building on the jQuery Framework
    • Using Existing jQuery Plug-ins
    • Convert Your Library to a jQuery Plug-in
    • Safely Combining Several Libraries in Your Applications
Chapter 18 Communication
    • Introduction
    • Accessing the XMLHttpRequest Object
    • Preparing the Data for Transmission
    • Determining the Type of Query Call
    • Adding a Callback Function to an Ajax Request
    • Checking for an Error Condition
    • Processing a Text Result
    • Making an Ajax Request to Another Domain (Using JSONP)
    • Populating a Selection List from the Server
    • Using a Timer to Automatically Update the Page with Fresh Data
    • Communicating Across Windows with PostMessage
Chapter 19 Working with Structured Data
    • Introduction
    • Process an XML Document Returned from an Ajax Call
    • Extracting Pertinent Information from an XML Tree
    • Generate a JavaScript Object with JSON, Old-School Style
    • Parse a JSON Formatted String
    • Convert an Object to a Filtered/Transformed String with JSON
    • Convert hCalendar Microformat Annotations into a Canvas Timeline
    • Glean Page RDFa and Convert It into JSON Using rdfQuery and the jQuery RDF Plug-in
Chapter 20 Persistence
    • Introduction
    • Attaching Persistent Information to URLs
    • Creating a Cookie to Persist Information Across Pages
    • Persisting Information Using the History.pushState Method and window.onpopevent
    • Using sessionStorage for Client-Side Storage
    • Creating a localStorage Client-Side Data Storage Item
    • Persisting Data Using a Relational Data Store
Chapter 21 JavaScript Outside the Box
    • Introduction
    • Creating a Browser Add-0n, Plug-in, or Extension
    • Creating Desktop and Mobile Widgets
    • Creating JavaScript Applications for the iPhone, Android, and BlackBerry with PhoneGap
    • Enhancing Tools with JavaScript
    • Creating Efficient Desktop Applications with Web Workers and the File API
    • Colophon


Best Sellers



Product Details
  • ISBN-13: 9789350230688
  • Publisher: O'Reilly
  • Publisher Imprint: O'Reilly
  • Language: English
  • ISBN-10: 9350230682
  • Publisher Date: 08 Jan 2010
  • Binding: Paperback
  • No of Pages: 644

Related Categories

Similar Products

How would you rate your experience shopping for books on Bookswagon?

Add Photo
Add Photo

Customer Reviews

REVIEWS           
Click Here To Be The First to Review this Product
JavaScript Cookbook
O'Reilly -
JavaScript Cookbook
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

JavaScript Cookbook

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book
    Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals



    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!