14.08.2016 Views

Beginning JavaScript with DOM Scripting and Ajax, 2nd Edition

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

■ Contents<br />

■■Chapter 10: Modern <strong>JavaScript</strong> Case Study: A Dynamic Gallery297<br />

Basics of Thumbnail Galleries297<br />

What Is a Thumbnail Gallery <strong>and</strong> What Should It Do?297<br />

Static Thumbnail Galleries298<br />

Faking Dynamic Galleries <strong>with</strong> <strong>JavaScript</strong>298<br />

Displaying Captions304<br />

Dynamic Thumbnail Galleries308<br />

Creating an Image Badge from a Folder312<br />

Summary319<br />

■■Chapter 11: Using Third-Party <strong>JavaScript</strong>321<br />

What the Web Offers You321<br />

REST APIs <strong>and</strong> Libraries321<br />

Using a Library: Short, Shorter, jQuery322<br />

Dangers of jQuery <strong>and</strong> Other Libraries Using Their Own Syntax 329<br />

Using an API: Adding a Map to Your Site <strong>with</strong> Google Maps329<br />

Full Service: Introducing Twitter Bootstrap335<br />

Adding Bootstrap to Your Site 335<br />

Summary342<br />

■■Appendix A: Debugging <strong>JavaScript</strong>343<br />

Common <strong>JavaScript</strong> Mistakes343<br />

Misspellings <strong>and</strong> Case-Sensitivity Issues 343<br />

Trying to Access Undefined Variables 344<br />

Incorrect Number of Closing Braces <strong>and</strong> Parentheses 346<br />

Concatenation Gone Wrong 349<br />

Assigning Instead of Testing the Value of a Variable 350<br />

Tracing Errors <strong>with</strong> alert( ) <strong>and</strong> “Console” Elements350<br />

Error H<strong>and</strong>ling <strong>with</strong> try <strong>and</strong> catch( )351<br />

Sequential Uncommenting352<br />

xii<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!