Home > Store > Open Source > Ajax & JavaScript

larger cover

Add To My Wish List

Register your product to gain access to bonus material or receive a coupon.

JavaScript in 24 Hours, Sams Teach Yourself, 5th Edition

Best Value Purchase

Book + eBook Bundle

  • Your Price: $37.79
  • List Price: $62.98
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Individual Purchases

Book

  • Your Price: $27.99
  • List Price: $34.99
  • Usually ships in 24 hours.

eBook (Watermarked)

  • Your Price: $22.39
  • List Price: $27.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

  • Description
  • Downloads
  • Extras
  • Sample Content
  • Updates
  • Copyright 2013
  • Dimensions: 7-1/2" x 9-1/8"
  • Pages: 448
  • Edition: 5th
  • Book
  • ISBN-10: 0-672-33608-1
  • ISBN-13: 978-0-672-33608-9

Learn JavaScript in 24 Hours

Covers JavaScript 1.8+, Ajax and jQuery


In just 24 lessons of one hour or less, you can learn how to create dynamic, interactive Web pages with the popular and ubiquitous JavaScript web programming language.


Using a straightforward, step-by-step approach, each lesson in this book clearly and carefully walks you through basic concepts and techniques, and helps you learn the essentials of JavaScript programming from the ground up.


Learn how to…

  • Use JavaScript to build dynamic, interactive Web pages
  • Debug scripts
  • Create scripts that work in all browsers
  • Work with HTML5 and CSS3
  • Leverage the popular jQuery library
  • Control CSS with simple JavaScripts
  • Add Ajax effects to your web pages
  • Script animations and music

Step-by-step instructions carefully walk you through the most common JavaScript programming tasks

Quizzes at end of every chapter help you build and test your knowledge

Interactive online exercises let you practice what you learn at the Codecademy web site with no downloads or installation needed


Sams Publishing has teamed up with Codecademy — the online place where anyone can learn and teach coding — to provide readers of Sams Teach Yoruself JavaScript in 24 Hours with an exclusive area on the Codecademy web site where you can supplement what you've learned in this book with some fun, fully interactive exercises and projects. After reading a lesson in the book you can roll up your sleeves and get some hands-on coding experience at codecademy.com/tracks/teachyourself



Downloads

Download free code files for Sams Teach Yourself JavaScript in 24 Hours here

Download version 2 of free code files for Sams Teach Yourself JavaScript in 24 Hours here

Online Sample Chapter

Using Functions in JavaScript

Sample Pages

Download the sample pages (includes Chapter 3 and Index)

Table of Contents

Introduction     1

Who This Book Is For      1

The Aims of This Book      1

Conventions Used      2

Q&A, Quiz, and Exercises      2

How the Book Is Organized      2

Tools You’ll Need      3

PART I: First Steps with JavaScript      5

HOUR 1: Introducing JavaScript      7

Web Scripting Fundamentals      7

Server- Versus Client-Side Programming      8

JavaScript in a Nutshell      8

Where JavaScript Came From      9

The <script> Tag      10

Introducing the DOM      11

Talking to the User      13

Summary      17

Q&A       18

Workshop      18

Exercises      19

HOUR 2: Writing Simple Scripts      21

Including JavaScript in Your Web Page      21

JavaScript Statements      23

Variables      24

Operators      26

Capturing Mouse Events      30

Summary      33

Q&A      34

Workshop      34

Exercises      35

HOUR 3: Using Functions      37

General Syntax      37

Calling Functions      38

Arguments      40

Returning Values from Functions      43

Scope of Variables      44

Summary      46

Q&A      47

Workshop      47

Exercises      48

HOUR 4: DOM Objects and Built-In Objects      49

Interacting with the User      49

Selecting Elements by Their id     51

Accessing Browser History      52

Using the location Object      53

Browser Information—The navigator Object      54

Dates and Times      57

Simplifying Calculation with the Math Object      59

Summary      64

Q&A      65

Workshop      65

Exercises      66

HOUR 5: Different Types of Data      67

Numbers      67

Strings      70

Boolean Values      73

Arrays      74

Summary      79

Q&A     80

Workshop      80

Exercises      81

PART II: More Advanced JavaScript      83

HOUR 6: Scripts That Do More      85

Conditional Statements      85

Loops and Control Structures      90

Debugging Your Scripts      94

Summary      100

Q&A      101

Workshop      101

Exercises      102

HOUR 7: Object Oriented Programming     103

What Is Object Oriented Programming (OOP)?      103

Object Creation      104

Extending and Inheriting Objects Using prototype      111

Encapsulation      115

Using Feature Detection      116

Summary      118

Q&A      119

Workshop      119

Exercises      120

HOUR 8: Meet JSON      121

What Is JSON?      121

Accessing JSON Data      123

Data Serialization with JSON      124

JSON Data Types      126

Simulating Associative Arrays      127

Creating Objects with JSON      127

JSON Security      131

Summary      132

Q&A     133

Workshop      133

Exercises      134

HOUR 9: Responding to Events      135

Understanding Event Handlers      135

Default Actions      138

The event Object      141

Cross-Browser Event Handlers      142

Advanced Event Handler Registration      146

Summary      151

Q&A      152

Workshop      152

Exercises      153

HOUR 10: JavaScript and Cookies      155

What Are Cookies?      155

The document.cookie Property      156

Cookie Ingredients      157

Writing a Cookie      158

A Function to Write a Cookie      159

Reading a Cookie      161

Deleting Cookies      162

Setting Multiple Values in a Single Cookie      165

Summary      166

Q&A       166

Workshop      

Exercises      168

PART III: Working with the Document Object Model (DOM)      169

HOUR 11: Navigating the DOM     171

DOM Nodes     171

Selecting Elements with getElementsByTagName()      177

Reading an Element’s Attributes      179

Mozilla’s DOM Inspector      180

Summary      181

Q&A     182

Workshop      182

Exercises      183

HOUR 12: Scripting the DOM      185

Creating New Nodes     185

Manipulating Child Nodes      187

Editing Element Attributes      191

Dynamically Loading JavaScript Files      192

Summary      198

Q&A      199

Workshop      199

Exercises      200

HOUR 13: JavaScript and CSS      201

A Ten Minute CSS Primer      201

The DOM style Property      204

Accessing Classes Using className      207

The DOM styleSheets Object      209

Summary      214

Q&A      215

Workshop      215

Exercises      216

HOUR 14: Good Coding Practice      217

Don’t Overuse JavaScript      217

Writing Readable and Maintainable Code      218

Graceful Degradation      221

Progressive Enhancement      222

Unobtrusive JavaScript      223

Feature Detection      226

Handling Errors Well      227

Summary      231

Q&A      232

Workshop      232

Exercises      233

HOUR 15: Graphics and Animation      235

Preloading Images      235

Animating Page Elements      236

Animating Transparency      238

CSS3 Transitions, Transformations, and Animations      239

Scripting DOM Positioning      240

Optimizing Performance      242

Summary      245

Q&A      246

Workshop      246

Exercises      247

PART IV: Ajax     249

HOUR 16: Introducing Ajax      251

The Anatomy of Ajax      251

The XMLHttpRequest Object      256

Creating Instances of XMLHttpRequest      256

Sending the Server Request      260

Monitoring Server Status      263

Callback Functions      264

responseText and responseXML Properties     265

Summary      269

Q&A      270

Workshop      270

Exercises      271

HOUR 17: Creating a Simple Ajax Library      273

An Ajax Library      273

Implementing the Library      274

Using the Library      278

Summary      284

Q&A      285

Workshop      285

Exercises      286

HOUR 18: Solving Ajax Problems      287

Debugging Ajax Applications      287

Common Ajax Errors     292

Some Programming Gotchas      297

Summary      298

Q&A      299

Workshop      299

Exercises      300

PART V: Using JavaScript Libraries      301

HOUR 19: Making Life Easier with Libraries      303

Why Use a Library?      303

What Sorts of Things Can Libraries Do?      304

Some Popular Libraries      305

Introducing prototype.js      306

Summary      313

Q&A     314

Workshop      314

Exercises      315

HOUR 20: A Closer Look at jQuery      317

Including jQuery in Your Pages      317

jQuery’s $(document).ready Handler      318

Selecting Page Elements      319

Working with HTML Content      320

Showing and Hiding Elements      321

Animating Elements      322

Command Chaining      324

Handling Events      328

Using jQuery to Implement Ajax      328

Summary      332

Q&A      333

Workshop      333

Exercises      334

HOUR 21: The jQuery UI User Interface Library      335

What jQuery UI Is All About      335

How to Include jQuery UI in Your Pages     336

Interactions      337

Using Widgets      343

Summary      348

Q&A      349

Workshop      349

Exercises      350

PART VI: Using JavaScript with Other Web Technologies      351

HOUR 22: JavaScript and Multimedia      353

Multimedia Formats      353

Browser Plug-Ins      355

Using an Anchor Tag      356

Using <embed> and <object>      356

Flash      358

Summary      362

Q&A      363

Workshop      363

Exercises      364

HOUR 23: HTML5 and JavaScript      365

New Markup for HTML5      365

Some Important New Elements      366

Drag and Drop      373

Local Storage      376

Working with Local Files      377

Summary      379

Q&A     380

Workshop      380

Exercises      381

HOUR 24: JavaScript Beyond the Web Page      383

JavaScript Outside the Browser      383

Writing Google Chrome Extensions      384

Summary      394

Q&A      395

Workshop      395

Exercises      396

PART VII: Appendices      397

APPENDIX A: Tools for JavaScript Development      399

Editors      399

Validators      400

Debugging and Verifying Tools      401

APPENDIX B: JavaScript Quick Reference      403

Index      411

FREE

ONE MONTH ACCESS!

WITH PURCHASE


Get unlimited 30-day access to thousands of Books & Training Videos about technology, professional development and digital media If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months.