Scriptin' with JavaScript and Ajax: a designer's guide

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

JavaScript is the brains of your Web page—it enables you to modify a document’s structure, styling, and content in response to user actions without requesting new pages from the server. Scriptin' with JavaScript and Ajax teaches you how to master this powerful and elegant language so you can develop intuitive user interactions that take the user experience to new levels of sophistication and responsiveness.Today’s application-like Web experiences (such as Salesforce.com and Google Maps) and Web 2.0 sites (such as Flickr.com and Twitter) are powered by JavaScript and Ajax. Using the techniques shown in this book, you will be able to start creating similar experiences in the sites you design.Scriptin' with JavaScript and Ajax will teach you how to:Start developing with JavaScript fast!Write lightweight but powerful object-oriented code Modify the Document Object Model “Progressively enhance” your pages with JavaScript to provide the highest levels of accessibility to all usersLearn sophisticated techniques for making your pages respond to user actionsUse the downloadable Scriptin’ library of helper functions to speed development and ensure cross-browser compatibilityUse Ajax scripting techniques to update specific areas of the page with data from the serverCreate powerful interface interactions, such as sliding panels and tree menusEvaluate frameworks such as jQuery and Prototype to find the best one for your needsBuild an online application that looks and responds like a regular desktop applicationEasily adapt the Scriptin’ code examples for use in your own projects—download them at www.scriptinwithajax.com

Author(s): Charles Wyke-Smith
Edition: 1
Publisher: Peachpit Press
Year: 2009

Language: English
Pages: 312
Tags: Библиотека;Компьютерная литература;HTML / CSS / JavaScript;

Contents......Page 9
Introduction......Page 13
CHAPTER 1: JAVASCRIPT COMES OF AGE......Page 19
Accessibility and Progressive Enhancement......Page 22
Three Steps to Progressive Enhancement......Page 24
1. Make It Functional......Page 25
2. Make It Look Good......Page 34
3. Enhance the Experience with JavaScript and Ajax......Page 38
Summary......Page 40
CHAPTER 2: JAVASCRIPT BASICS......Page 41
Running the Code Examples......Page 43
Hello, JavaScript......Page 44
Statements......Page 45
Comments......Page 46
Variables......Page 47
Strings......Page 49
Arrays......Page 51
Operators......Page 55
Loops and Iterating Over Data......Page 63
Functions......Page 67
Summary......Page 72
CHAPTER 3: OBJECTS AND THE DOM......Page 73
Objects......Page 75
Predefined JavaScript Objects......Page 76
User-created Objects......Page 77
Objects and Instances......Page 80
Getting Around the DOM......Page 85
Get, Set...DOM!......Page 87
Modifying Element Styles......Page 92
Zebra Tables......Page 95
Refactoring the Code......Page 102
Summary......Page 104
CHAPTER 4: EVENTS......Page 105
JavaScript Pseudo Protocol......Page 107
Inline Event Handler......Page 108
Handler as Object Property......Page 110
Event Listeners......Page 111
The First Event: load......Page 114
Adding Event Listeners on Page Load......Page 116
The Event Object......Page 120
The Event Object’s Type Property......Page 121
The Event Object in Microsoft Browsers......Page 122
The Secret Life of Events......Page 128
Event Delegation......Page 129
Using an Element as a Debugging Tool......Page 130
Event Delegation......Page 131
Determining the Target Element......Page 133
Traversing the DOM......Page 135
Adding the Highlight......Page 137
The Up and Down Life of Keys......Page 139
Text Fields with Character Limits......Page 140
Setting Up the Message Display......Page 141
Monitoring the Character Count......Page 144
The Finished Code......Page 147
Summary......Page 148
CHAPTER 5: AJAX......Page 149
Ajax by the Letters......Page 151
Communication with the Server......Page 153
The XMLHttpRequest Object......Page 155
How to Use the XMLHttpRequest (XHR) Object......Page 156
Using the Ajax Function......Page 161
Using an Object Literal to Maintain State Through an Ajax Call......Page 163
Creating a Simple Catalog......Page 166
Using PHP Templates......Page 167
An Ajax-ready Page......Page 172
Adding Ajax Functionality to the Catalog......Page 173
An Accessible Catalog......Page 178
Working with JSON......Page 179
The Guitar Catalog Using JSON......Page 181
Using XML......Page 184
Using Sajax—the Simple Ajax Framework......Page 189
Summary......Page 194
CHAPTER 6: FRAMEWORKS......Page 195
Advantages of Frameworks......Page 197
Considerations When Using a Framework......Page 198
Namespacing......Page 199
Pseudo-global Variables......Page 201
jQuery Namespace......Page 203
Prototype......Page 205
Yahoo! User Interface (YUI)......Page 206
Adobe Spry......Page 207
Accordion with jQuery and Spry......Page 208
Highlight with Prototype and Spry......Page 212
Drag-and-drop with Prototype and jQuery......Page 214
Tabs with jQuery and Spry......Page 217
Summary......Page 220
CHAPTER 7: TWO SIMPLE WEB APPLICATIONS......Page 221
About the Projects......Page 223
An Image Carousel......Page 224
A Location Finder with AutoComplete......Page 225
Building the Author Carousel......Page 226
Styling the Carousel......Page 228
Managing the Scrollbar......Page 231
The PHP Backend......Page 232
Layering on the JavaScript......Page 239
Implementing the Carousel Interactions......Page 241
Implementing the Overlay......Page 245
Parsing the JSON with JavaScript......Page 247
AutoComplete and Maps with the Yahoo! API......Page 250
The Project Template—index.php......Page 251
The Search Form Script—searchform.php......Page 256
Implementing Search Without JavaScript—searchresults.php......Page 265
Summary......Page 267
APPENDIX: A......Page 269
APPENDIX: B......Page 275
APPENDIX: C......Page 289
APPENDIX: D......Page 293
A......Page 299
C......Page 300
E......Page 301
F......Page 302
H......Page 303
J......Page 304
M......Page 305
P......Page 306
R......Page 307
T......Page 308
W......Page 309
Z......Page 310