Head First JavaScript

( 4 )

Overview

So you're ready to make the leap from writing HTML and CSS web pages to creating dynamic web applications. You want to take your web skills to the next level. And you're finally ready to add "programmer" to the resume. It sounds like you're ready to learn the Web's hottest programming language: JavaScript. Head First JavaScript is your ticket to going beyond copying and pasting the code from someone else's web site, and writing your own ...

See more details below
Paperback
$25.82
BN.com price
(Save 35%)$39.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (25) from $2.11   
  • New (3) from $22.67   
  • Used (22) from $2.11   
Sending request ...

Overview

So you're ready to make the leap from writing HTML and CSS web pages to creating dynamic web applications. You want to take your web skills to the next level. And you're finally ready to add "programmer" to the resume. It sounds like you're ready to learn the Web's hottest programming language: JavaScript. Head First JavaScript is your ticket to going beyond copying and pasting the code from someone else's web site, and writing your own interactive web pages.

With Head First JavaScript, you learn:

  • The basics of programming, from variables to types to looping
  • How the web browser runs your code, and how you can talk to the browser with your code
  • Why you'll never have to worry about casting, overloading, or polymorphism when you're writing JavaScript code
  • How to use the Document Object Model to change your web pages without making your users click buttons
If you've ever read a Head First book, you know what to expect — a visually rich format designed for the way your brain works. Head First JavaScript is no exception. It starts where HTML and CSS leave off, and takes you through your first program into more complex programming concepts — like working directly with the web browser's object model and writing code that works on all modern browsers.

Don't be intimidated if you've never written a line of code before! In typical Head First style, Head First JavaScript doesn't skip steps, and we're not interested in having you cut and paste code. You'll learn JavaScript, understand it, and have a blast along the way. So get ready... dynamic and exciting web pages are just pages away.

Read More Show Less

Product Details

  • ISBN-13: 9780596527747
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/21/2007
  • Series: Head First Series
  • Edition number: 1
  • Pages: 652
  • Sales rank: 359,159
  • Product dimensions: 8.00 (w) x 9.20 (h) x 1.70 (d)

Meet the Author

Michael Morrison is a writer, developer, toy inventor, and author of a variety of books covering topics such as Java, Web scripting, game development, and mobile devices. Some of Michael's notable writing projects include JavaScript Bible, 6th Edition (Wiley, 2006),Teach Yourself HTML and CSS in 24 Hours, 7th Edition (Sams Publishing, 2005), Beginning Mobile Phone Game Programming (Sams Publishing, 2004) and Java Unleashed (Sams Publishing, 1997). Michael is the intructor of several Web-based courses, including DigitalThink's Introduction to Java 2 series, JavaBeans for Programmers series, and Win32 Programming series (http://www.digitalthink.com).

In addition to his primary profession as a writer and technical consultant, Michael is the founder of Stalefish Labs (http://www.stalefishlabs.com), an entertainment company specializing in games, toys, and interactive media. When not glued to his computer, skateboarding, playing hockey, or watching movies with his wife, Masheed, Michael enjoys hanging out by his koi pond.

Read More Show Less

Table of Contents

;
Head First JavaScript;
What will you learn from this book?;
Why does this book look so different?;
Advance Praise for Head First JavaScript;
Praise for Head First HTML with CSS & XHTML;
Author of Head First JavaScript;
How to Use This Book: Intro;
Who is this book for?;
We know what you’re thinking;
We know what your brain is thinking;
Metacognition: thinking about thinking;
Here’s what WE did;
Read Me;
The technical review team;
Acknowledgments;
Safari® Books Online;
Chapter 1: The Interactive Web: Reacting to the Virtual World;
1.1 (Online) people have needs;
1.2 Like talking to a brick wall... nothing happens;
1.3 But JavaScript talks back;
1.4 Lights, camera, inter action!;
1.5 Use the tag to tell the browser you’re writing JavaScript;
1.6 Your web browser can handle HTML, CSS, AND JavaScript;
1.7 Man’s virtual best friend... needs YOUR help;
1.8 Making iRock interactive;
1.9 Create the iRock web page;
1.10 Test drive;
1.11 JavaScript events: giving the iRock a voice;
1.12 Alerting the user with a function;
1.13 Add the iRock greeting;
1.14 Test drive your interactive rock;
1.15 Now let’s make the iRock really interactive;
1.16 Interaction is TWO-way communication;
1.17 Add a function to get the user’s name;
1.18 Instant replay: what just happened?;
1.19 Test drive iRock 1.0;
Chapter 2: Storing Data: Everything Has Its Place;
2.1 Your scripts can store data;
2.2 Scripts think in data types;
2.3 Constants stay the SAME, variables can CHANGE;
2.4 Variables start out without a value;
2.5 Initialize a variable with “=”;
2.6 Constants are resistant to change;
2.7 What’s in a name?;
2.8 Legal and illegal variable and constant names;
2.9 Variable names often use CamelCase;
2.10 The next big thing (in donuts);
2.11 Plan the Duncan’s Donuts web page;
2.12 A first take at the donut calculations;
2.13 Initialize your data...or else;
2.14 NaN is NOT a number;
2.15 Meanwhile, back at Duncan’s...;
2.16 You can add more than numbers;
2.17 parseInt() and parseFloat(): converts text to a number;
2.18 Why are extra donuts being ordered?;
2.19 You figured out the problem...;
2.20 Duncan discovers donut espionage;
2.21 Use getElementById() to grab form data;
2.22 Validate the web form’s data;
2.23 You saved Duncan’s Donuts... again!;
2.24 Strive for intuitive user input;
2.25 Just-in-time donuts a smashing success!;
Chapter 3: Exploring the Client: Browser Spelunking;
3.1 Clients, servers, and JavaScript;
3.2 What can a browser do for you?;
3.3 The iRock is too happy;
3.4 The iRock needs to be more responsive;
3.5 Timers connect action to elapsed time;
3.6 Breaking down a timer;
3.7 Set a timer with setTimeout();
3.8 A closer look: the setTimeout() function;
3.9 Now the iRock gets lonely!;
3.10 Multiple size screens, multiple complaints;
3.11 Use the document object to get the client window’s width;
3.12 Use document object properties to set the client window width;
3.13 Set the height and width of the iRock image;
3.14 The iRock should be sized to the page;
3.15 Your iRock...evolves!;
3.16 onresize is triggered when the browser’s resized;
3.17 The onresize event resizes the rock;
3.18 Have we met? Recognizing the user;
3.19 Every script has a life cycle;
3.20 Cookies outlive your script’s life cycle;
3.21 Cookies have a name and store a value...and can expire;
3.22 Your JavaScript can live OUTSIDE your web page;
3.23 Greet the user with a cookie;
3.24 greetUser() is cookie-powered now;
3.25 Don’t forget to set the cookie, too;
3.26 Cookies affect browser security;
3.27 A world without cookies;
3.28 Talk to the users... it’s better than nothing;
3.29 An iRock fit for a JavaScript king;
Chapter 4: Decision Making: If There’s a Fork in the Road, Take It;
4.1 Lucky contestant, come on down!;
4.2 Choices are all about making a decision;
4.3 “if” this is true... then do something;
4.4 An if statement evaluates a condition... and then takes action;
4.5 Use if to choose between two things;
4.6 You can make multiple decisions with if;
4.7 Adding an else to your if statement;
4.8 An adventure of epic proportions;
4.9 The adventure setup;
4.10 Variables drive the story;
4.11 But part of the story is missing;
4.12 Compounding your JavaScript efforts;
4.13 The adventure begins;
4.14 And now, the rest of the adventure;
4.15 Tiered decision making with if/else;
4.16 An if can go inside another if;
4.17 Your functions control your pages;
4.18 Pseudocode lets you map out your adventure;
4.19 Going on a stick figure adventure;
4.20 Stick figure inequality;
4.21 != Psst, I’ve got nothing to tell you...;
4.22 Crafting decisions with comparison operators;
4.23 Comments, placeholders, and documentation;
4.24 Comments in JavaScript start with //;
4.25 Scope and context: where data lives;
4.26 Check your adventure variable score;
4.27 Where does my data live?;
4.28 Choice of five;
4.29 Nesting if/else can get complicated;
4.30 Switch statements have multiple cases;
4.31 Inside the switch statement;
4.32 Switch case statements: write your own;
4.33 A switchy stick figure adventure: test-drive;
4.34 The story goes on...;
Chapter 5: Looping: At the Risk of Repeating Myself;
5.1 X marks the spot;
5.2 DÉjà vu all over again...for loops;
5.3 Treasure hunting with a for loop;
5.4 Dissect the for loop;
5.5 Mandango: a macho movie seat finder;
5.6 First check seat availability;
5.7 Looping, HTML, and seat availability;
5.8 Movie seats as variables;
5.9 Arrays collect multiple pieces of data;
5.10 Array values are stored with keys;
5.11 From JavaScript to HTML;
5.12 Visualizing Mandango seats;
5.13 Not so macho seat searching;
5.14 Test drive: the solo seat finder;
5.15 Too much of a good thing: endless loops;
5.16 Loops always need an exit condition (or two!);
5.17 A “break” in the action;
5.18 Putting the ‘man’ in Mandango;
5.19 A logical, elegant, well-designed solution with &&
5.20 Boolean operator logic uncovered;
5.21 Finally, a manly seat finder;
5.22 Back to the treasure map;
5.23 Looping for just a “while”...until a condition is met;
5.24 Breaking down the while loop;
5.25 Use the right loop for the job;
5.26 Treasure at the end of the loop;
5.27 Movie seat data modeling;
5.28 An array of an array: two-dimensional arrays;
5.29 Two keys to access 2-D array data;
5.30 Mandango in 2-D;
5.31 An entire theater of manly seats;
Chapter 6: Functions: Reduce, Reuse, Recycle;
6.1 The mother of all problems;
6.2 Solve big problems by solving small problems;
6.3 Functions as problem solvers;
6.4 The nuts and bolts of a function;
6.5 A function you’ve already met;
6.6 Build a better thermostat with more data;
6.7 Passing information to functions;
6.8 Function arguments as data;
6.9 Functions eliminate duplicate code;
6.10 Creating a seat setter function;
6.11 A leaner, cleaner Mandango with functions;
6.12 The setSeat() function makes Mandango even better;
6.13 The significance of feedback;
6.14 Returning data from functions;
6.15 Many happy return values;
6.16 Getting the status of a seat;
6.17 Showing the seat status;
6.18 You can link the function to an image;
6.19 Repetitive code is never a good thing;
6.20 Separate your functionality from your content;
6.21 Functions are just data;
6.22 Calling or referencing your functions;
6.23 Events, callbacks, and HTML attributes;
6.24 Wiring events using function references;
6.25 Function literals to the rescue;
6.26 Where’s the wiring?;
6.27 A shell of an HTML page;
6.28 One small step for JavaScript...;
Chapter 7: Forms and Validation: Getting the User to Tell All;
7.1 Bannerocity: messaging the friendly skies;
7.2 The Bannerocity HTML form;
7.3 When HTML is not enough;
7.4 Accessing form data;
7.5 Form fields follow a chain of events;
7.6 Losing focus with onblur;
7.7 You can use an alert box for validation messages;
7.8 Checking for... something;
7.9 Validate fields to make sure you have “not nothing”;
7.10 Validation without aggravating alert boxes;
7.11 A more subtle non-empty validator;
7.12 Too much of a good thing;
7.13 Size matters...;
7.14 Validating the length of data;
7.15 Message problem solved;
7.16 Right banner, wrong location;
7.17 Validating a ZIP code;
7.18 Timing is everything...date validation;
7.19 Validating a date;
7.20 Regular expressions aren’t “regular”;
7.21 Regular expressions define patterns to match;
7.22 Regular expressions exposed;
7.23 Metacharacters represent more than one literal character;
7.24 Drilling into regular expressions: quantifiers;
7.25 Pattern quantification;
7.26 Validating data with regular expressions;
7.27 Matching mins and maxes;
7.28 Eliminating three-digit years with this...or that;
7.29 Leave nothing to chance;
7.30 Can you hear me now? Phone number validation;
7.31 You’ve got mail: validating email;
7.32 The exception is the rule;
7.33 Matching optional characters from a set;
7.34 Constructing an email validator;
7.35 A bulletproof Bannerocity form;
Chapter 8: Wrangling the Page: Slicing and Dicing HTML with the DOM;
8.1 Functional but clumsy...interface matters;
8.2 Describing scenes without alert boxes;
8.3 Creating space on the page with div;
8.4 Accessing HTML elements;
8.5 Getting in touch with your inner HTML;
8.6 An adventure with less interruptions;
8.7 Seeing the forest and the trees: the Document Object Model (DOM);
8.8 Your page is a collection of DOM nodes;
8.9 Climbing the DOM tree with properties;
8.10 Changing node text with the DOM;
8.11 Three (safe) steps for changing node text;
8.12 Standards compliant adventuring;
8.13 In search of better options;
8.14 Designing better, cleaner options;
8.15 Rethinking node text replacement;
8.16 Replacing node text with a function;
8.17 Dynamic options are a good thing;
8.18 Interactive options are even better;
8.19 A matter of style: CSS and DOM;
8.20 Swapping style classes;
8.21 Classy options;
8.22 Test drive the stylized adventure options;
8.23 Options gone wrong: the empty button;
8.24 A la carte style tweaking;
8.25 No more bogus options;
8.26 More options, more complexity;
8.27 Tracking the decision tree;
8.28 Turn your decision history into HTML;
8.29 Manufacturing HTML code;
8.30 Tracing the adventure story;
8.31 A long strange trip...;
Chapter 9: Bringing Data to Life: Objects as Frankendata;
9.1 A JavaScript-powered party;
9.2 Data + actions = object;
9.3 An object owns its data;
9.4 Object member references with a dot;
9.5 A blog for cube puzzlers;
9.6 Deconstructing YouCube;
9.7 Custom objects extend JavaScript;
9.8 Construct your custom objects;
9.9 What’s in a constructor?;
9.10 Bringing blog objects to life;
9.11 YouCube 1.0;
9.12 A disorderly blog;
9.13 The need for sorting;
9.14 A JavaScript object for dating;
9.15 Calculating time;
9.16 Rethinking blog dates;
9.17 An object within an object;
9.18 Dates aren’t useful...for humans;
9.19 Converting objects to text;
9.20 Accessing pieces and parts of a date;
9.21 Dates make sorting easy;
9.22 Arrays as objects;
9.23 Custom sorting an array;
9.24 Sorting made simple with function literals;
9.25 Ruby and her cubes are happy;
9.26 Searching would be nice;
9.27 Searching the blog array;
9.28 Searching within strings: indexOf();
9.29 Searching the blog array;
9.30 Searching works now, too!;
9.31 A random YouCube;
9.32 The Math object is an organizational object;
9.33 Generate random numbers with Math.random;
9.34 Random but still lacking;
9.35 An object in search of actions;
9.36 Turn a function into a method;
9.37 Unveiling the shiny new blog object;
9.38 What do objects really offer YouCube?;
9.39 YouCube 3.0!;
Chapter 10: Creating Custom Objects: Having It Your Way with Custom Objects;
10.1 Revisiting the YouCube Blog methods;
10.2 Method overload;
10.3 Classes vs. instances;
10.4 Instances are created from classes;
10.5 Access an instance’s properties with “this”;
10.6 Own once, run many: class-owned methods;
10.7 Use prototype to work at a class-level;
10.8 Classes, prototypes, and YouCube;
10.9 A more efficient YouCube;
10.10 Signing the blog;
10.11 Class properties are shared, too;
10.12 Creating class properties with prototype;
10.13 Signed and delivered;
10.14 Duplicate code is a no-no;
10.15 A date formatting method;
10.16 Extending standard objects;
10.17 Custom date object = better YouCube;
10.18 A class can have its own method;
10.19 Examine the sort comparison function;
10.20 Calling a class method;
10.21 A picture is worth a thousand blog words;
10.22 Incorporating images into YouCube;
10.23 An optional blog image;
10.24 Adding imagery to YouCube;
10.25 An object-powered YouCube;
Chapter 11: Kill Bugs Dead: Good Scripts Gone Wrong;
11.1 Real-world debugging;
11.2 The case of the buggy IQ calculator;
11.3 Try different browsers;
11.4 Firefox to the rescue;
11.5 Debugging on easy street;
11.6 The bug report isn’t always the bug source;
11.7 Variables gone wild undefined;
11.8 Sometimes it’s the simple things;
11.9 Crunching the intelligence numbers;
11.10 The case of the radio call-in bugs;
11.11 Opening up the investigation;
11.12 A question of syntax validation (Bug #1);
11.13 Careful with those strings;
11.14 Quotes, apostrophes, and consistency;
11.15 When a quote isn’t a quote, use escape characters;
11.16 Undefined isn’t just for variables (Bug #2);
11.17 The usual suspects: the checklist;
11.18 Everyone’s a winner (Bug #3);
11.19 Alert box debugging;
11.20 Watching variables with alert;
11.21 Bad logic is legal but buggy;
11.22 Everyone’s a loser! (Bug #4);
11.23 Overwhelmed by annoying alerts;
11.24 Browser debugging consoles can help;
11.25 Build a custom console for debugging;
11.26 Debug your debugger;
11.27 Waiting on the page;
11.28 The peskiest errors of all: runtime;
11.29 The JavaScript bug trifecta;
11.30 It’s not a num-bah;
11.31 When watching isn’t enough;
11.32 Comments as temporary code disablers;
11.33 Problem solved...sort of;
11.34 The dangers of shadowy variables;
11.35 Case closed!;
Chapter 12: Dynamic Data: Touchy-Feely Web Applications;
12.1 Yearning for dynamic data;
12.2 A data-driven YouCube;
12.3 Ajax is all about communication;
12.4 An HTML for everything: XML;
12.5 XML lets you tag YOUR data YOUR way;
12.6 XML is just text;
12.7 XML + HTML = XHTML;
12.8 XML and the YouCube blog data;
12.9 Injecting YouCube with Ajax;
12.10 JavaScript to the Ajax rescue: XMLHttpRequest;
12.11 XMLHttpRequest is pretty complex;
12.12 Of gets and posts;
12.13 Get or Post? A request with XMLHttpRequest;
12.14 Make XMLHttpRequest less painful;
12.15 Making sense of an Ajax request;
12.16 The ball request enters the server’s court;
12.17 Interactive pages start with a request object;
12.18 Call me when you’re done;
12.19 Handling a response...seamlessly;
12.20 The DOM to the rescue;
12.21 YouCube is driven by its data;
12.22 Dysfunctional buttons;
12.23 The buttons need data;
12.24 Time-saving web-based blog additions;
12.25 Writing blog data;
12.26 PHP to the rescue...this time;
12.27 PHP has needs, too;
12.28 Feeding data to the PHP script;
12.29 Getting it up: Posting blog data to the server;
12.30 Blogging made easy;
12.31 Making YouCube more, uh, usable;
12.32 Auto-fill fields for your users;
12.33 Repetitive task? How about a function?;
12.34 Blog productivity soars;
12.35 Where do you go from here?;

Read More Show Less

Customer Reviews

Average Rating 3
( 4 )
Rating Distribution

5 Star

(1)

4 Star

(0)

3 Star

(1)

2 Star

(1)

1 Star

(1)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Posted October 10, 2009

    Exactly what it is meant for

    This book makes it fun, and amusing, to learn JavaScript. Lets face it, code books can be a little rough around the edges when it comes to learning it from scratch, but Head First book are excellent at taking a novice and teaching them what they need to know, in a logical order, and in a memorable way! I recommend this book to anyone that is only a little familiar with any type of code and needs to learn JavaScript.

    3 out of 3 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted June 2, 2009

    Possibly the worst schoolbook ever

    a teacher decided to make this the text for a class because he thought it would be a fun way to learn. big mistake. the whole class was confused at to what to do and how to write the code. the author does a poor job of explaining everything and jumps around. the index is a joke. while trying to be innovative the book fails to be useful

    2 out of 2 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 27, 2010

    No text was provided for this review.

  • Anonymous

    Posted October 12, 2009

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)