Tài liệu Ebook head first javascript

  • Số trang: 652 |
  • Loại file: PDF |
  • Lượt xem: 171 |
  • Lượt tải: 0

Đã đăng 10809 tài liệu

Mô tả:

Download at WoweBook.Com Advance Praise for Head First JavaScript “So practical and useful, and so well explained. This book does a great job of introducing a complete newbie to JavaScript, and it’s another testament to Head First’s teaching style. Out of the other JavaScript books, Head First JavaScript is great for learning, compared to other reference books the size of a phone book.” — Alex Lee, Student, University of Houston “An excellent choice for the beginning JavaScript developer.” — Fletcher Moore, Web Developer & Designer, Georgia Institute of Technology “Yet another great book in the classic ‘Head First’ style.” — TW Scannell “JavaScript has long been the client-side engine that drives pages on the Web, but it has also long been misunderstood and misused. With Head First JavaScript, Michael Morrison gives a straightforward and easy-to-understand introduction of this language, removing any misunderstanding that ever existed and showing how to most effectively use it to enhance your web pages.” — Anthony T. Holdener III, Web applications developer, and the author of Ajax: The Definitive Guide. “A web page has three parts—content (HTML), appearance (CSS), and behaviour (JavaScript). Head First HTML introduced the first two, and this book uses the same fun but practical approach to introduce JavaScript. The fun way in which this book introduces JavaScript and the many ways in which it reinforces the information so that you will not forget it makes this a perfect book for beginners to use to start them on the road to making their web pages interactive.” — Stephen Chapman, Owner Felgall Pty Ltd., JavaScript editor, about.com “This is the book I’ve been looking for to recommend to my readers. It is simple enough for complete beginners but includes enough depth to be useful to more advanced users. And it makes the process of learning fun. This might just be the only JavaScript book you ever need.” — Julie L Baumler, JavaScript Editor, BellaOnline.com Download at WoweBook.Com Praise for Head First HTML with CSS & XHTML If you haven’t read this book yet, and you’re new to JavaScript, we recommed that you do. “Eric and Elisabeth Freeman clearly know their stuff. As the Internet becomes more complex, inspired construction of web pages becomes increasingly critical. Elegant design is at the core of every chapter here, each concept conveyed with equal doses of pragmatism and wit.” — Ken Goldstein, Executive Vice President & Managing Director, Disney Online “The Web would be a much better place if every HTML author started off by reading this book.” — L. David Baron, Technical Lead, Layout & CSS, Mozilla Corporation, http://dbaron.org/ “I’ve been writing HTML and CSS for ten years now, and what used to be a long trial and error learning process has now been reduced neatly into an engaging paperback. HTML used to be something you could just hack away at until things looked okay on screen, but with the advent of web standards and the movement towards accessibility, sloppy coding practice is not acceptable anymore... from a business standpoint or a social responsibility standpoint. Head First HTML with CSS & XHTML teaches you how to do things right from the beginning without making the whole process seem overwhelming. HTML, when properly explained, is no more complicated than plain English, and the Freemans do an excellent job of keeping every concept at eye-level.” — Mike Davidson, President & CEO, Newsvine, Inc. “Oh, great. You made an XHTML book simple enough a CEO can understand it. What will you do next? Accounting simple enough my developer can understand it? Next thing you know we’ll be collaborating as a team or something.” —Janice Fraser, CEO, Adaptive Path “This book has humor, and charm, but most importantly, it has heart. I know that sounds ridiculous to say about a technical book, but I really sense that at its core, this book (or at least its authors) really care that the reader learn the material. This comes across in the style, the language, and the techniques. Learning – real understanding and comprehension – on the part of the reader is clearly top most in the minds of the Freemans. And thank you, thank you, thank you, for the book’s strong, and sensible advocacy of standards compliance. It’s great to see an entry level book, that I think will be widely read and studied, campaign so eloquently and persuasively on behalf of the value of standards compliance in web page code. I even found in here a few great arguments I had not thought of – ones I can remember and use when I am asked – as I still am – ‘what’s the deal with compliance and why should we care?’ I’ll have more ammo now! I also liked that the book sprinkles in some basics about the mechanics of actually getting a web page live - FTP, web server basics, file structures, etc.” —Robert Neer, Director of Product Development, Movies.com Download at WoweBook.Com Praise for Head First HTML with CSS & XHTML ““Freeman’s Head First HTML with CSS & XHTML is a most entertaining book for learning how to build a great web page. It not only covers everything you need to know about HTML, CSS, and XHTML, it also excels in explaining everything in layman’s terms with a lot of great examples. I found the book truly enjoyable to read, and I learned something new!” — Newton Lee, Editor-in-Chief, ACM Computers in Entertainment, http://www.acmcie.org “My wife stole the book. She’s never done any web design, so she needed a book like Head First HTML with CSS & XHTML to take her from beginning to end. She now has a list of web sites she wants to build – for our son’s class, our family, ... If I’m lucky, I’ll get the book back when she’s done.” — David Kaminsky, Master Inventor, IBM “Beware. If you’re someone who reads at night before falling asleep, you’ll have to restrict Head First HTML with CSS & XHTML to daytime reading. This book wakes up your brain.” — Pauline McNamara, Center for New Technologies and Education, Fribourg University, Switzerland “The information covered in this book is the same material the pros know, but taught in an educational and humorous manner that doesn’t ever make you think the material is impossible to learn or you are out of your element.” —Christopher Schmitt, Author of The CSS Cookbook and Professional CSS, schmitt@christopher.org “Head First HTML with CSS & XHTML is a thoroughly modern introduction to forward-looking practices in Web page markup and presentation. It correctly anticipates readers’ puzzlements and handles them just in time. The highly graphic and incremental approach precisely mimics the best way to learn this stuff: make a small change and see it in the browser to understand what each new item means.” —Danny Goodman, author of Dynamic HTML: The Definitive Guide Download at WoweBook.Com Other related books from O’Reilly JavaScript: The Definitive Guide JavaScript Pocket Reference Learning JavaScript JavaScript & DHTML Cookbook Other books in O’Reilly’s Head First series Head First Java Head First Object-Oriented Analysis and Design (OOA&D) Head Rush Ajax Head First HTML with CSS and XHTML Head First Design Patterns Head First Servlets and JSP Head First EJB Head First PMP Head First SQL Head First Software Development Head First C# Download at WoweBook.Com Head First JavaScript Wouldn’t it be dreamy if there was a way to learn JavaScript from a book without wanting to set fire to it halfway through and swearing off the Web forever? I know, it’s probably just a fantasy... Michael Morrison Beijing • Cambridge • Kln • Paris • Sebastopol • Taipei • Tokyo Download at WoweBook.Com Head First JavaScript by Michael Morrison Copyright © 2008 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly Media books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Series Creators: Kathy Sierra, Bert Bates Series Editor: Brett D. McLaughlin Editor: Catherine Nolan Design Editor: Louise Barr Cover Designers: Louise Barr, Steve Fehler Production Editor: Sanders Kleinfeld Proofreader: Colleen Gorman Indexer: Julie Hawks Page Viewers: Masheed Morrison (wife), family, and pet fish ...but my koi fish couldn’t care less. Printing History: December 2007: First Edition. My family knows how to celebrate a book release... The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. The Head First series designations, Head First JavaScript, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. No rocks, stick figures, cube puzzles, or macho moviegoers were harmed in the making of this book. Just me, but I can handle it...I’m wiry. TM This book uses RepKover™,  a durable and flexible lay-flat binding. ISBN-10: 0-596-52774-8 ISBN-13: 978-0-596-52774-7 [M] Download at WoweBook.Com [2/08] To the folks at Netscape who, way back in the last century, dreamed that the Web could be much more than a big online book with a bunch of linked pages that don’t do anything. Of course, they also dreamed up that horrific tag...dare to dream, just don’t get too carried away! Download at WoweBook.Com the author Author of Head First JavaScript n, Michael Morriipsot cr child JavaS prodigy. Michael Morrison, full-size nerd who refuses to grow up. Michael Morrison has been tinkering with computers since his first PC, a TI-99/4A, complete with its supremely ergonomic keyboard, state of the art black and white TV “monitor,” and sweet cassette tape storage system. He has owned and tinkered with a few more computers since then, but still longs for the days of playing Parsec on that TI in between epic Nerf football games in the backyard. Now Michael is all grown up and has moved on to much more mature interests, such as creating interactive web applications...and skateboarding. Cut, bruised, and often limping, he approaches tech challenges with the same reckless intensity as high-risk sports. After developing a few video games, inventing a couple of toys, writing dozens of computer books, and creating numerous online courses, Michael finally felt ready to tackle Head First JavaScript. He no longer trusts his feelings. As it turns out, you’re never really ready to write a Head First book. The best you can be is ready to pop the red pill and enter the Matrix that is Head First. Having emerged from the other side with a few intellectual bruises to add to his real ones, Michael will never look at learning (or teaching) the same again. And he’s thrilled about that fact. Right about now he’s with his wife next to their koi pond reflecting on the wonders of the interactive Web. viii Download at WoweBook.Com table of contents Table of Contents (Summary) Intro xxiii 1 the interactive web: Reacting to the Virtual World 1 2 storing data: Everything Has Its Place 33 3 exploring the client: Browser Spelunking 85 4 decision making: If There’s a Fork in the Road, Take It 135 5 looping: At the Risk of Repeating Myself 189 6 functions: Reduce, Reuse, Recycle 243 7 forms and validation: Getting the User to Tell All 289 8 wrangling the page: Slicing and Dicing HTML with the DOM 343 9 bringing data to life: Objects as Frankendata 393 10 creating custom objects: Having It Your Way with Custom Objects 449 11 kill bugs dead: Good Scripts Gone Wrong 485 12 dynamic data: Touchy-Feely Web Applications 537 Table of Contents (the real thing) Intro Your brain on JavaScript.  You’re sitting around trying to learn something, but your brain keeps telling you all that learning isn’t important. Your brain’s saying, “Better leave room for more important things, like which wild animals to avoid and whether naked water skiing is a bad idea.” So how do you trick your brain into thinking that your life really depends on learning JavaScript? Who is this book for? xxiv We know what you’re thinking xxv Metacognition xxvii Bend your brain into submission xxix Read me xxx The technical review team xxxii Acknowledgments xxxiii ix Download at WoweBook.Com table of contents 1 the interactive web Reacting to the Virtual World Tired of thinking of the Web in terms of passive pages? Been there, done that. They’re called books. And they’re good for reading, learning... lots of good things. But they’re not interactive. And neither is the Web without a little help from JavaScript. Sure, you can submit a form and maybe do a trick here and there with some crafty HTML and CSS coding, but you’re really just playing Weekend at Bernie’s propping up a lifeless web page. Real live interactivity requires a bit more smarts and a little more work... but it has a much bigger payoff. (Online) people have needs 2 Like talking to a brick wall... nothing happens 3 But JavaScript talks back 4 Lights, camera, interaction! 6 Use the