Views
5 years ago

Pro JavaScript Techniques

Pro JavaScript Techniques

Pro JavaScript

THE EXPERT’S VOICE ® IN WEB DEVELOPMENT Pro JavaScript Techniques John Resig Real-world JavaScript techniques for the modern, professional web developer

  • Page 2 and 3: Pro JavaScript Techniques John Res
  • Page 4 and 5: Contents at a Glance About the Auth
  • Page 6 and 7: Contents About the Author . . . . .
  • Page 8 and 9: PART 3 ■ ■ ■ Unobtrusive Java
  • Page 10 and 11: Displaying Error Messages . . . . .
  • Page 12 and 13: PART 5 ■ ■ ■ The Future of Ja
  • Page 14: ■CONTENTS xiii Mouse Events. . .
  • Page 18: About the Technical Reviewer ■DAN
  • Page 22: PART 1 ■ ■ ■ Introducing Mode
  • Page 25 and 26: 4 CHAPTER 1 ■ MODERN JAVASCRIPT P
  • Page 27 and 28: 6 CHAPTER 1 ■ MODERN JAVASCRIPT P
  • Page 29 and 30: 8 CHAPTER 1 ■ MODERN JAVASCRIPT P
  • Page 31 and 32: 10 CHAPTER 1 ■ MODERN JAVASCRIPT
  • Page 33 and 34: 12 CHAPTER 1 ■ MODERN JAVASCRIPT
  • Page 35 and 36: 14 CHAPTER 1 ■ MODERN JAVASCRIPT
  • Page 37 and 38: 16 CHAPTER 1 ■ MODERN JAVASCRIPT
  • Page 40 and 41: CHAPTER 2 ■ ■ ■ Object-Orient
  • Page 42 and 43: Set itemsRef to a reference to item
  • Page 44 and 45: Additionally, there exists another
  • Page 46 and 47: } } // If they do not, throw a usef
  • Page 48 and 49: Listing 2-12. Example of Implicit G
  • Page 50 and 51: scope. This is generally considered
  • Page 52 and 53:

    However, we now point window.no to

  • Page 54 and 55:

    a particular class, but that is not

  • Page 56 and 57:

    We can see that the two methods we

  • Page 58 and 59:

    Listing 2-25. Example of Dynamicall

  • Page 60 and 61:

    CHAPTER 3 ■ ■ ■ Creating Reus

  • Page 62 and 63:

    Thankfully, one of the masters of J

  • Page 64 and 65:

    Function.prototype.method: This ser

  • Page 66 and 67:

    Create a new User class that inheri

  • Page 68 and 69:

    Class.create(): This function simpl

  • Page 70 and 71:

    The User object inherits all the fu

  • Page 72 and 73:

    Pane 1 Nunc consequat nisi vitae

  • Page 74 and 75:

    Listing 3-11. Variable Delcaration

  • Page 76 and 77:

    JSMin The premise behind JSMin is s

  • Page 78 and 79:

    comes into play. JSAN was started b

  • Page 80 and 81:

    CHAPTER 4 ■ ■ ■ Tools for Deb

  • Page 82 and 83:

    • The console allows you to enter

  • Page 84 and 85:

    As a web development platform, Safa

  • Page 86 and 87:

    Safari Web Inspector Safari has a n

  • Page 88 and 89:

    Firebug Firebug is one of the most

  • Page 90 and 91:

    By having a solid set of test cases

  • Page 92 and 93:

    The documentation for JSUnit is qui

  • Page 94:

    Personally, I enjoy the simplicity

  • Page 98 and 99:

    CHAPTER 5 ■ ■ ■ The Document

  • Page 100 and 101:

    Figure 5-2. Navigating the DOM tree

  • Page 102 and 103:

    Listing 5-2. A Workaround for the W

  • Page 104 and 105:

    Listing 5-4. A Function for Finding

  • Page 106 and 107:

    This makes your code much cleaner a

  • Page 108 and 109:

    Waiting for the HTML DOM to Load On

  • Page 110 and 111:

    1. document: You need to see whethe

  • Page 112 and 113:

    domReady(function() { alert( "The D

  • Page 114 and 115:

    #main p: This expression finds an

  • Page 116 and 117:

    XPath XPath expressions are an incr

  • Page 118 and 119:

    Let’s look at how get the text of

  • Page 120 and 121:

    Working with Element Attributes Nex

  • Page 122 and 123:

    } // Return the value of the attrib

  • Page 124 and 125:

    Modifying the DOM By knowing how to

  • Page 126 and 127:

    Listing 5-25. A Helper Function for

  • Page 128 and 129:

    } // Extract the DOM structure back

  • Page 130 and 131:

    Listing 5-29. Function for Removing

  • Page 132 and 133:

    CHAPTER 6 ■ ■ ■ Events The mo

  • Page 134 and 135:

    In reality, since our while loop co

  • Page 136 and 137:

    moves back up the tree again, and t

  • Page 138 and 139:

    Listing 6-4. Overriding Functionali

  • Page 140 and 141:

    What you’re probably wondering no

  • Page 142 and 143:

    Listing 6-8. A Generic Function for

  • Page 144 and 145:

    Attach a keypress event handler to

  • Page 146 and 147:

    DOM Binding: IE In a lot of ways, t

  • Page 148 and 149:

    Listing 6-15. The addEvent/removeEv

  • Page 150 and 151:

    Considering just how powerful the a

  • Page 152 and 153:

    found that their e-mail, posts, and

  • Page 154:

    } // Attach a mouseout and blur eve

  • Page 157 and 158:

    136 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 159 and 160:

    138 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 161 and 162:

    140 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 163 and 164:

    142 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 165 and 166:

    144 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 167 and 168:

    146 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 169 and 170:

    148 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 171 and 172:

    150 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 173 and 174:

    152 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 175 and 176:

    154 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 177 and 178:

    156 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 179 and 180:

    158 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 181 and 182:

    160 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 183 and 184:

    162 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 185 and 186:

    164 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 187 and 188:

    166 CHAPTER 7 ■ JAVASCRIPT AND CS

  • Page 190 and 191:

    CHAPTER 8 ■ ■ ■ Improving For

  • Page 192 and 193:

    Listing 8-2. The CSS Styles Used to

  • Page 194 and 195:

    However, a problem occurs when you

  • Page 196 and 197:

    E-mail Asking for an e-mail address

  • Page 198 and 199:

    Get an input element to check var e

  • Page 200 and 201:

    }; // Makes sure that the field is

  • Page 202 and 203:

    } } // Check to see if the element

  • Page 204 and 205:

    When to Validate One of the most tr

  • Page 206 and 207:

    } } // Locate the first form on the

  • Page 208 and 209:

    Finally, you need to be sure not to

  • Page 210 and 211:

    One aspect of adding these cues to

  • Page 212 and 213:

    CHAPTER 9 ■ ■ ■ Building an I

  • Page 214 and 215:

    Unfortunately, the unobtrusive natu

  • Page 216 and 217:

    }); // Remove the focus from the li

  • Page 218 and 219:

    * Create a standard-width and heigh

  • Page 220 and 221:

    Listing 9-5. Injecting the Initial

  • Page 222 and 223:

    Next, you need to create the two fu

  • Page 224 and 225:

    Positioned Box The component of the

  • Page 226 and 227:

    }; // Set the adjusted position of

  • Page 228 and 229:

    Now that you have the important ste

  • Page 230 and 231:

    Slideshow The final piece of your i

  • Page 232 and 233:

    Listing 9-18. Additional CSS for Di

  • Page 234:

    PART 4 ■ ■ ■ Ajax

  • Page 237 and 238:

    216 CHAPTER 10 ■ INTRODUCTION TO

  • Page 239 and 240:

    218 CHAPTER 10 ■ INTRODUCTION TO

  • Page 241 and 242:

    220 CHAPTER 10 ■ INTRODUCTION TO

  • Page 243 and 244:

    222 CHAPTER 10 ■ INTRODUCTION TO

  • Page 245 and 246:

    224 CHAPTER 10 ■ INTRODUCTION TO

  • Page 247 and 248:

    226 CHAPTER 10 ■ INTRODUCTION TO

  • Page 249 and 250:

    228 CHAPTER 10 ■ INTRODUCTION TO

  • Page 251 and 252:

    230 CHAPTER 10 ■ INTRODUCTION TO

  • Page 253 and 254:

    232 CHAPTER 10 ■ INTRODUCTION TO

  • Page 255 and 256:

    234 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 257 and 258:

    236 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 259 and 260:

    238 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 261 and 262:

    240 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 263 and 264:

    242 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 265 and 266:

    244 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 267 and 268:

    246 CHAPTER 11 ■ ENHANCING BLOGS

  • Page 269 and 270:

    248 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 271 and 272:

    250 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 273 and 274:

    252 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 275 and 276:

    254 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 277 and 278:

    256 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 279 and 280:

    258 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 281 and 282:

    260 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 283 and 284:

    262 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 285 and 286:

    264 CHAPTER 12 ■ AUTOCOMPLETE SEA

  • Page 287 and 288:

    266 CHAPTER 13 ■ AN AJAX WIKI Fig

  • Page 289 and 290:

    268 CHAPTER 13 ■ AN AJAX WIKI Lis

  • Page 291 and 292:

    270 CHAPTER 13 ■ AN AJAX WIKI How

  • Page 293 and 294:

    272 CHAPTER 13 ■ AN AJAX WIKI Now

  • Page 295 and 296:

    274 CHAPTER 13 ■ AN AJAX WIKI The

  • Page 297 and 298:

    276 CHAPTER 13 ■ AN AJAX WIKI •

  • Page 299 and 300:

    278 CHAPTER 13 ■ AN AJAX WIKI ret

  • Page 301 and 302:

    280 CHAPTER 13 ■ AN AJAX WIKI //

  • Page 303 and 304:

    282 CHAPTER 13 ■ AN AJAX WIKI # O

  • Page 306:

    PART 5 ■ ■ ■ The Future of Ja

  • Page 309 and 310:

    288 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 311 and 312:

    290 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 313 and 314:

    292 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 315 and 316:

    294 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 317 and 318:

    296 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 319 and 320:

    298 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 321 and 322:

    300 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 323 and 324:

    302 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 325 and 326:

    304 CHAPTER 14 ■ WHERE IS JAVASCR

  • Page 328 and 329:

    APPENDIX A ■ ■ ■ DOM Referenc

  • Page 330 and 331:

    Element An element is a container t

  • Page 332 and 333:

    childNodes This is a property of al

  • Page 334 and 335:

    Listing A-10. Creating a New Eleme

  • Page 336 and 337:

    nodeName This is a property availab

  • Page 338 and 339:

    the word class is a reserved word i

  • Page 340 and 341:

    DOM Modification The following are

  • Page 342 and 343:

    This function takes two arguments:

  • Page 344:

    Listing A-29. Removing All Elements

  • Page 347 and 348:

    326 APPENDIX B ■ EVENTS REFERENCE

  • Page 349 and 350:

    328 APPENDIX B ■ EVENTS REFERENCE

  • Page 351 and 352:

    330 APPENDIX B ■ EVENTS REFERENCE

  • Page 353 and 354:

    332 APPENDIX B ■ EVENTS REFERENCE

  • Page 355 and 356:

    334 APPENDIX B ■ EVENTS REFERENCE

  • Page 357 and 358:

    336 APPENDIX B ■ EVENTS REFERENCE

  • Page 359 and 360:

    338 APPENDIX B ■ EVENTS REFERENCE

  • Page 361 and 362:

    340 APPENDIX B ■ EVENTS REFERENCE

  • Page 363 and 364:

    342 APPENDIX B ■ EVENTS REFERENCE

  • Page 366 and 367:

    APPENDIX C ■ ■ ■ The Browsers

  • Page 368:

    Version 8.5 Version 8.5 was the fir

  • Page 371 and 372:

    350 ■INDEX ■B element, 309 bas

  • Page 373 and 374:

    352 ■INDEX global variables docum

  • Page 375 and 376:

    354 ■INDEX Firebug browser, 5, 67

  • Page 377 and 378:

    356 ■INDEX line numbers, Safari,

  • Page 379 and 380:

    358 ■INDEX ■S Safari browser, 2

Pro JavaScript for Web Apps pdf - EBook Free Download
Advanced Design Techniques: JavaScript to the Rescue - QuirksMode
JavaScript Examples Bible - UserWorks Technologies
Start Here! Learn JavaScript - Cdn.oreilly.com
Unobtrusive JavaScript with jQuery - Simon Willison's Weblog
JavaScript Class 3: Element Manipulation - Live to Try
Beginning_Ajax_with_PHP._From_novice_to_professional
[+]The best book of the month Pro TypeScript: Application-Scale JavaScript Development [NEWS]
exquisite handmade technique at your will - Pro Bike Center
Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...
www.free-ebooks-download.org
jQuery 1.4 Animation Techniques - Index of
Metro Revealed - Download Center - Microsoft
ASP.NET MVC 4 in Action - Manning Publications
CHAPTER 4 Using ASP.NET AJAX JavaScript Extensions4
CHAPTER 4 Using ASP.NET AJAX JavaScript Extensions4
Cascading Style Sheets, JavaScript Style Sheets, & JavaScripted