Tài liệu Simply JavaScript

Thảo luận trong 'Lập Trình' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    173
    Điểm thành tích:
    0
    Xu:
    0Xu
    Preface . xvii
    Who Should Read this Book? xviii
    What’s Covered in this Book? xviii
    The Book’s Web Site . xx
    The Code Archive . xx
    Updates and Errata xx
    The SitePoint Forums xxi
    The SitePoint Newsletters xxi
    Your Feedback . xxi
    Acknowledgments xxi
    Kevin Yank xxi
    Cameron Adams . xxii
    Conventions Used in this Book . xxiii
    Code Samples . xxiii
    Tips, Notes, and Warnings . xxiv
    Chapter 1 The Three Layers of the Web . 1

    Keep ’em Separated 2
    Three Layers . 4
    HTML for Content . 6
    CSS for Presentation . 8
    JavaScript for Behavior . 9
    The Right Way 11
    JavaScript Libraries 11
    Let’s Get Started! . 12
    Chapter 2 Programming with JavaScript . 13
    Running a JavaScript Program 14
    Statements: Bite-sized Chunks for your Browser . 17
    Comments: Bite-sized Chunks Just for You 18
    Variables: Storing Data for your Program . 19
    Variable Types: Different Types for Different Data 23
    Conditions and Loops: Controlling Program Flow . 35
    Conditions: Making Decisions . 36
    Loops: Minimizing Repetition . 43
    Functions: Writing Code for Later . 48
    Arguments: Passing Data to a Function 50
    Return Statements: Outputting Data from a Function 52
    Scope: Keeping your Variables Separate 54
    Objects 55
    Unobtrusive Scripting in the Real World 58
    Summary 59
    Chapter 3 Document Access 61
    The Document Object Model: Mapping your HTML . 61
    Text Nodes 64
    Attribute Nodes 65
    Accessing the Nodes you Want 66
    Finding an Element by ID 67
    Finding Elements by Tag Name 70
    Finding Elements by Class Name 74
    Navigating the DOM Tree 79
    Interacting with Attributes . 82
    Changing Styles 85
    Changing Styles with Class . 87
    Example: Making Stripy Tables 92
    Finding All Tables with Class dataTable . 93
    Getting the Table Rows for Each Table . 94
    Adding the Class alt to Every Second Row . 96
    Putting it All Together . 96
    Exploring Libraries 99
    Prototype . 99
    jQuery . 100
    Dojo . 102
    Summary . 102
    Chapter 4 Events . 105
    An Eventful History 106
    Event Handlers 107
    Default Actions . 111
    The this Keyword . 112
    The Problem with Event Handlers 115
    Event Listeners 116
    Default Actions . 119
    Event Propagation . 122
    The this Keyword . 127
    The Internet Explorer Memory Leak . 128
    Putting it All Together 129
    Example: Rich Tooltips 132
    The Static Page 133
    Making Things Happen . 134
    The Workhorse Methods 135
    The Dynamic Styles 140
    Putting it All Together 142
    Example: Accordion 144
    The Static Page 144
    The Workhorse Methods 146
    The Dynamic Styles 148
    Putting it All Together 150
    Exploring Libraries . 158
    Summary . 160
    Chapter 5 Animation . 163
    The Principles of Animation . 163
    Controlling Time with JavaScript . 165
    Using Variables with setTimeout . 168
    Stopping the Timer 172
    Creating a Repeating Timer . 174
    Stopping setInterval . 175
    Revisiting Rich Tooltips . 175
    Old-school Animation in a New-school Style . 176
    Path-based Motion . 181
    Animating in Two Dimensions . 190
    Creating Realistic Movement 192
    Moving Ahead 198
    Revisiting the Accordion Control . 198
    Making the Accordion Look Like it’s Animated . 198
    Changing the Code 199
    Exploring Libraries . 208
    script.aculo.us . 208
    Summary . 211
    Chapter 6 Form Enhancements . 213
    HTML DOM Extensions 214
    Example: Dependent Fields 216
    Example: Cascading Menus 226
    Form Validation . 239
    Intercepting Form Submissions 240
    Regular Expressions 243
    Example: Reusable Validation Script 249
    Custom Form Controls 256
    Example: Slider 256
    Exploring Libraries . 271
    Form Validation . 272
    Custom Controls . 274
    Summary . 275
    Chapter 7 Errors and Debugging . 277
    Nothing Happened! 278
    Common Errors 282
    Syntax Errors . 283
    Runtime Errors 288
    Logic Errors . 292
    Debugging with Firebug 296
    Summary . 303
    Chapter 8 Ajax . 305
    XMLHttpRequest: Chewing Bite-sized Chunks of Content 306
    Creating an XMLHttpRequest Object 307
    Calling a Server . 310
    Dealing with Data . 314
    A Word on Screen Readers 316
    Putting Ajax into Action 316
    Seamless Form Submission with Ajax 329
    Exploring Libraries . 337
    Prototype 339
    Dojo . 340
    jQuery . 341
    YUI 341
    MooTools . 342
    Summary . 343
    Chapter 9 Looking Forward . 345
    Bringing Richness to the Web 346
    Easy Exploration . 346
    Easy Visualization 347
    Unique Interaction . 349
    Rich Internet Applications . 352
    Widgets 355
    JavaScript Off the Web . 356
    Exploring Libraries . 357
    Dojo . 358
    Google Web Toolkit 361
    Summary . 362
    Appendix A The Core JavaScript Library 363
    The Object 363
    Event Listener Methods . 364
    Script Bootstrapping . 375
    CSS Class Management Methods . 378
    Retrieving Computed Styles . 379
    The Complete Library . 379
    Index . 387
     

    Các file đính kèm:

Đang tải...