Bilbia de JavaScript

 

Embed or link this publication

Description

La Biblia de JavaScript

Popular Pages


p. 1

g o l d advance your javascript skills with the most comprehensive resource available edition i highly recommend danny goodman s javascript bible brendan eich creator of javascript conquer high-end scripting challenges using the latest techniques optimize scripts for internet explorer 5.5 and netscape navigator 6 features 15 bonus chapters javascript cd-rom inside nearly 300 ready-to-run example scripts and more on cd-rom the definitive javascript guide over 175,000 copies in print ® bible danny goodman javascript pioneer and consultant with a foreword by brendan eich creator of javascript

[close]

p. 2

praise for danny goodman s javascript bible javascript bible is the definitive resource in javascript programming i am never more than three feet from my copy steve reich ceo pagecoders this book is a must-have for any web developer or programmer thoma lile president kanis technologies inc outstanding book i would recommend this book to anyone interested in learning to develop advanced web sites mr goodman did an excellent job of organizing this book and writing it so that even a beginning programmer can understand it jason hensley director of internet services netvoice inc goodman is always great at delivering clear and concise technical books dwayne king chief technology officer white horse javascript bible is well worth the money spent yen c.y leong it director moo mooltimedia a member of smarttransact group a must-have book for any internet developer uri fremder senior consultant toptier software i love this book i use it all the time and it always delivers it s the only javascript book i use jason badger web developer whether you are a professional or a beginner this is a great book to get brant mutch web application developer wells fargo card services inc i never thought i d ever teach programming before reading your book [javascript bible it s so simple to use the programming fundamentals section brought it all back thank you for such a wonderful book and for breaking through my programming block susan sann mahon certified lotus instructor technet training i continue to get so much benefit from javascript bible what an amazing book danny goodman is the greatest patrick moss danny goodman is very good at leading the reader into the subject javascript bible has everything we could possibly need philip gurdon

[close]

p. 3

an excellent book that builds solidly from whatever level the reader is at a book that is both witty and educational dave vane i continue to use the book on a daily basis and would be lost without it mike warner founder oak place productions javascript bible is by far the best javascript resource i ve ever seen and i ve seen quite a few robert j mirro independent consultant rjm consulting

[close]

p. 4

javascript bible gold edition ®

[close]

p. 5



[close]

p. 6

javascript bible gold edition ® danny goodman with a foreword by brendan eich creator of javascript best-selling books · digital downloads · e-books · answer networks · e-newsletters · branded web sites · e-learning indianapolis in cleveland oh new york ny

[close]

p. 7

javascript® bible gold edition published by hungry minds inc 909 third avenue new york ny 10022 www.hungryminds.com copyright © 2001 danny goodman all rights reserved no part of this book including interior design cover design and icons may be reproduced or transmitted in any form by any means electronic photocopying recording or otherwise without the prior written permission of the publisher library of congress control number 2001090713 isbn 0-7645-4718-6 printed in the united states of america 10 9 8 7 6 5 4 3 2 1 1p/rv/qw/qr/in distributed in the united states by hungry minds inc distributed by cdg books canada inc for canada by transworld publishers limited in the united kingdom by idg norge books for norway by idg sweden books for sweden by idg books australia publishing corporation pty ltd for australia and new zealand by transquest publishers pte ltd for singapore malaysia thailand indonesia and hong kong by gotop information inc for taiwan by icg muse inc for japan by intersoft for south africa by eyrolles for france by international thomson publishing for germany austria and switzerland by distribuidora cuspide for argentina by lr international for brazil by galileo libros for chile by ediciones zeta s.c.r ltda for peru by ws computer publishing corporation inc for the philippines by contemporanea de ediciones for venezuela by express computer distributors for the caribbean and west indies by micronesia media distributor inc for micronesia by chips computadoras s.a de c.v for mexico by editorial norma de panama s.a for panama by american bookshops for finland for general information on hungry minds products and services please contact our customer care department within the u.s at 800-762-2974 outside the u.s at 317-572-3993 or fax 317-572-4002 for sales inquiries and resellers information including discounts premium and bulk quantity sales and foreign language translations please contact our customer care department at 800-434-3422 fax 317-572-4002 or write to hungry minds inc attn customer care department 10475 crosspoint boulevard indianapolis in 46256 for information on licensing foreign or domestic rights please contact our sub-rights customer care department at 212-884-5000 for information on using hungry minds products and services in the classroom or for ordering examination copies please contact our educational sales department at 800-434-2086 or fax 317-572-4005 for press review copies author interviews or other publicity information please contact our public relations department at 317-572-3168 or fax 317-572-4168 for authorization to photocopy items for corporate personal or educational use please contact copyright clearance center 222 rosewood drive danvers ma 01923 or fax 978-750-4470 limit of liability/disclaimer of warranty the publisher and author have used their best efforts in preparing this book the publisher and author make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose there are no warranties which extend beyond the descriptions contained in this paragraph no warranty may be created or extended by sales representatives or written sales materials the accuracy and completeness of the information provided herein and the opinions stated herein are not guaranteed or warranted to produce any particular results and the advice and strategies contained herein may not be suitable for every individual neither the publisher nor author shall be liable for any loss of profit or any other commercial damages including but not limited to special incidental consequential or other damages trademarks javascript is a registered trademark or trademark of sun microsystems inc all other trademarks are property of their respective owners hungry minds inc is not associated with any product or vendor mentioned in this book is a trademark of hungry minds inc.

[close]

p. 8

about the author danny goodman is the author of numerous critically acclaimed and best-selling books including the complete hypercard handbook danny goodman s applescript handbook and dynamic html the definitive reference he is a renowned authority and expert teacher of computer scripting languages and is widely known for his javascript apostle articles at netscape s viewsource online developer newsletter his writing style and pedagogy continue to earn praise from readers and teachers around the world to help keep his finger on the pulse of real-world programming challenges goodman frequently lends his touch as consulting programmer and designer to leading-edge world wide web and intranet sites from his home base in the san francisco area.

[close]

p. 9

credits acquisitions editor debra williams cauley project editor neil romanosky technical editor david wall copy editors jerelind charles victoria lee o malley proof editor cordelia heaney editorial manager colleen totz project coordinators cindy phipps regina snyder graphics and production specialists sean decker john greenough leandra johnson stephanie johnson gabriele mccann jill piscitelli heather pope ron terry erin zeltner quality control technicians laura albert joel draper andy hollandbeck susan moritz permissions editor laura moss media development specialist greg stephens media development coordinator marisa pearman book designer kurt krames proofreading techbooks production services indexer johnna vanhoose dinse cover illustrator kate shaw

[close]

p. 10

foreword s javascript s creator i would like to say a few words about where javascript has been where it is going and how the book you re holding will help you to make the most of the language javascript was born out of a desire to let html authors write scripts directly in their documents this may seem obvious now but in the spring of 1995 it was novel and more than a little at odds with both the conventional wisdom that html should describe static document structure only and the next big thing java applets which were hyped as the one true way to enliven and extend web pages once i got past these contentions javascript quickly shaped up along the following lines java-lite syntax although the natural language syntax of hypertalk was fresh in my mind after a friend lent me the complete hypercard handbook by some fellow named goodman the next big thing weighed heavier especially in light of another goal scripting java applets if the scripting language resembled java then those programmers who made the jump from javascript to java would welcome similarities in syntax but insisting on java s class and type declarations or on a semicolon after each statement when a line ending would do was out of the question scripting for most people is about writing short snippets of code quickly and without fuss events for html elements buttons should have onclick event handlers documents load and unload from windows so windows should have onload and onunload handlers users and scripts submit forms thus the onsubmit handler although not initially as flexible as hypercard s messages whose handlers inspired the onevent naming convention javascript events let html authors take control of user interaction from remote servers and respond quickly to user gestures and browser actions with the adoption of the w3c dom level 2 event handling recommendations javascript in modern browsers has fully flexible control over events objects without classes the self programming language proved the notion of prototype-based inheritance for javascript i wanted a single prototype per object for simplicity and efficiency based by default on the function called using the new operator for consonance with java to avoid distinguishing constructors from methods from functions all functions receive the object naming them as the property that was called in the this parameter although prototypes didn t appear until navigator 3 they were prefigured in version 2 by quoted text being treated as an object the string object prototype to which users could attach methods generated html embedding javascript in html gave rise to a thought let the script speak html as if the emitted text and markup were loaded in place of the script itself the possibilities went beyond automating current or last-modified dates to computing whole trees of tables where all the repeated structure was rolled up in a scripted loop while the varying contents to be tabulated came in minimal fashion from javascript objects forming a catalog or mini-database a

[close]

p. 11

x javascript bible gold edition at first i thought javascript would most often find use in validating input to html forms but before long i was surprised to see how many web designers devised compelling applications by way of script-generated html and javascript objects it became clear from user demonstration and feedback that web designers sought to build significant applications quickly and effectively with just a few images html and javascript eventually they demanded that the browser support what is now known as dynamic html one fun link http www.javascript-games.org as legions of web authors embraced the authoring power of javascript they in turn demonstrated the crucial advantages of a scripting environment over old-school application development not only were the html and javascript languages comparatively easy to use but development did not require the programming expertise needed to light all pixels and handle all events as in a big traditional application the primacy of javascript on the web today vindicates our early belief in the value of a scripting language for html authors by keeping the pixel-lighting bar low html with images has made web designers out of millions of people by keeping the event-handling bar low javascript has helped many thousands of those designers become programmers perhaps the ultimate example of web development s convergence with application development is the mozilla browser wherein all of the user-interface and even some custom widgets and modular components are implemented entirely using javascript cascading style sheets css custom xml-based markup languages and images javascript is also a general language useful apart from html and xml it has been embedded in servers authoring tools browser plug-ins and other kinds of browsers for such things as 3d graphical worlds its international standard ecma-262 iso 16262 has advanced to a third edition but compared with languages such as perl and even java it is still relatively young work toward a fourth edition of the language supporting optional types classes and versioning facilities progresses within the ecma technical committee see the js2 proposal to the ecma technical committee documented at http www.mozilla.org/js/language/js20 it is clear to me that javascript would not have survived without a creative loyal and patient community of developers i owe them each a huge debt of thanks those developers who took up the beta releases of navigator 2 and disseminated vital workarounds and feature requests by e-mail and net-news are the language s godparents developer support and feedback continue to make javascript the eclectic rambunctious success it is the book in your hands compiles thousands of those developer miles with the insight of an expert guide and teacher danny didn t know at the time how much inspiration i found in his hypercard book but it was on my desk throughout the development of javascript in 1995 his energy compassion and clear prose helped me keep the goal of a language for all in mind it is enormously gratifying to write the foreword to the gold edition of this book which has earned so many satisfied reader miles i highly recommend danny goodman s javascript bible to anyone who wants to learn javascript and especially to those html authors who ve so far written only a few scripts or programs you re in for a lifetime of fun on the scripting road with a trusty guide at your side brendan eich the mozilla organization http www.mozilla.org

[close]

p. 12

preface f or nearly 20 years i have written the books i wished had already been written to help me learn or use a new technology whenever possible i like to get in at the very beginning of a new authoring or programming environment feel the growing pains and share with readers the solutions to my struggles this gold edition of the javascript bible represents knowledge and experience accumulated over five years of daily work in javascript and a constant monitoring of newsgroups for questions problems and challenges facing scripters at all levels my goal is to help you avoid the same frustration and head scratching i and others have experienced through multiple generations of scriptable browsers while previous editions of this book focused on the then-predominant netscape navigator browser the swing of the browser market share pendulum currently favors microsoft internet explorer at the same time netscape has accomplished the admirable task of reinventing its own browser in light of rapidly advancing industry standards as a result of both of these trends this massively revised and expanded gold edition treats both brands of browsers as equals as far as scripters are concerned you hear my praise and dismay at various scripting features of both browser families but empowering you to design and write good scripts is my passion regardless of browser therefore the book contains details about proprietary and standard implementations to equip you to choose the development path that best fits your content s audience if you detect any bias of mine throughout this book it is a desire where possible to write scripts that work on as many browsers as possible organization and features of this edition because of the greatly expanded range of vocabularies that scripts may use in the latest browser versions the biggest change to the structure of the book is in the reference portion in this edition you find a greater distinction between the document object model and core javascript language reference sections this new division should help those readers who are primarily interested in only the javascript language for use in other applications find what they need more quickly here are some details about the book s structure part i part i of the book begins with a chapter that shows how javascript compares with java and discusses its role within the rest of the world wide web the web browser and scripting world have undergone significant changes since javascript first

[close]

p. 13

xii javascript bible gold edition arrived on the scene that s why chapter 2 is devoted to addressing challenges facing scripters who must develop applications for both single and cross-platform browser audiences amid rapidly changing standards efforts chapter 3 provides the first foray into javascript where you get to write your first practical script part ii all of part ii is handed over to a tutorial for newcomers to javascript nine lessons provide you with a gradual path through browser internals basic programming skills and genuine javascript scripting with only a couple of clearly labeled items the lessons cover scripting topics that apply to all scriptable browsers exercises follow at the end of each lesson to help reinforce what you just learned and challenge you to use your new knowledge you ll find answers to the exercises in appendix c the goal of the tutorial is to equip you with sufficient experience to start scripting simple pages right away while making it easier for you to understand the in-depth discussions and examples in the rest of the book by the end of the final lesson you ll know how to script multiple frame environments and even create the mouserollover image swapping effect that is popular in a lot of web pages these days on the cd-rom you can find all of the part ii chapters on the cd-rom that accompanies this book part iii part iii the largest section of the book provides in-depth coverage of the document object models as implemented in browsers from the earliest days to today in all reference chapters a compatibility chart indicates the browser version that supports each object and object feature one chapter in particular chapter 15 contains reference material that is shared by most of the remaining chapters of part iii to help you refer back to chapter 15 from other chapters a dark tab along the outside edge of the page shows you at a glance where the chapter is located additional navigation aids include guide words at the bottoms of most pages to indicate which object and object feature is covered on the page part iv reference information for the core javascript language fills part iv as with reference chapters of part iii the javascript chapters display browser compatibility charts for every javascript language term guide words at the bottoms of pages help you find a particular term quickly part v in part v i get down to the business of deploying javascript here are the practical aspects of javascript such as chapter 43 s coverage of client-side form data validation and chapter 44 s coverage of blending java applets and plug-ins into pages.

[close]

p. 14

preface xiii debugging scripts is the focus of chapter 45 with tips on understanding error messages building your own debugging tools chapter 46 goes into great detail about security issues for javascript-enabled applications dynamic html in a crossbrowser environment is the subject of chapter 47 while chapter 48 introduces you to microsoft s behaviors mechanism for windows the remaining nine chapters consist of full-fledged applications of javascript these applications are designed not necessarily as plug-and-play modules you can put into your pages right away instead their goal is to demonstrate many of the concepts described earlier in the book by way of real-world examples new for this edition are some examples based on xml data islands in internet explorer for windows part vi finally several appendixes at the end of the book provide helpful reference information these resources include a javascript and browser objects quick reference in appendix a a list of javascript reserved words in appendix b answers to part ii s tutorial exercises in appendix c and internet resources in appendix d in appendix e you also find information on using the cd-rom that comes with this book cd-rom the accompanying cd-rom contains over 300 ready-to-run html documents that serve as examples of most of the document object model and javascript vocabulary words in parts iii and iv you can run these examples with your javascriptenabled browser but be sure to use the index.html page in the listings folder as a gateway to running the listings this page shows you the browsers that are compatible with each example listing i could have provided you with humorous little sample code fragments out of context but i think that seeing full-fledged html documents simple though they may be for employing these concepts is important i intentionally omitted the script listings from the tutorial part part ii of this book to encourage you to type the scripts i believe you learn a lot even by aping listings from the book as you get used to the rhythms of typing scripts in documents you also find listings from parts i and v on the cd-rom the cd-rom holds another valuable resource dozens and dozens of example sections for parts iii and iv which are compiled in appendix f many of these sections reveal detailed descriptions of html listings that illustrate a particular object model or language feature even more example sections invite you to try out an object model or language feature with the help of an interactive workbench called the evaluator a javascript bible exclusive you see instant results and quickly learn how the feature works the quick reference from appendix a is in .pdf format on the cd-rom for you to print out and assemble as a handy reference if desired adobe acrobat reader is also included on the cd-rom so that you can read this .pdf file finally the text of the book is in a .pdf file format on the cd-rom for easy searching.

[close]

p. 15

xiv javascript bible gold edition prerequisites to learning javascript although this book doesn t demand that you have a great deal of programming experience behind you the more web pages you ve created with html the easier you will find it to understand how javascript interacts with the familiar elements you normally place in your pages occasionally you will need to modify html tags to take advantage of scripting if you are familiar with those tags already the javascript enhancements will be simple to digest forms and their elements text fields buttons and selection lists play an especially important role in much of typical javascript work you should be familiar with these elements and their html attributes fortunately you won t need to know about server scripting or passing information from a form to a server the focus here is on client-side scripting which operates independently of the server after the javascript-enhanced html page is fully loaded into the browser the basic vocabulary of the current html standard should be part of your working knowledge when we get to using frames for instance the focus is on how to script these elements not on designing pages with them microsoft netscape and other online sources provide more detailed explanations of frames if you ve never programmed before to someone who learned html from a slim guidebook a few years ago the size of this book must be daunting javascript may not be the easiest language in the world to learn but believe me it s a far cry from having to learn a full programming language such as java or c unlike developing a full-fledged monolithic application such as the productivity programs you buy in the stores javascript lets you experiment by writing small snippets of program code to accomplish big things the javascript interpreter built into every scriptable browser does a great deal of the technical work for you programming at its most basic level consists of nothing more than writing a series of instructions for the computer to follow we humans follow instructions all the time even if we don t realize it traveling to a friend s house is a sequence of small instructions go three blocks that way turn left here turn right there amid these instructions are some decisions that we have to make if the stoplight is red then stop if the light is green then go if the light is yellow then floor it occasionally we must repeat some operations several times kind of like having to go around the block until a parking space opens up a computer program not only contains the main sequence of steps but it also anticipates what decisions or repetitions may be needed to accomplish the program s goal such as how to handle the various states of a stoplight or what to do if someone just stole the parking spot you were aiming for the initial hurdle of learning to program is becoming comfortable with the way a programming language wants its words and numbers organized in these instructions such rules are called syntax the same as in a living language because computers generally are dumb electronic hulks they aren t very forgiving if you don t

[close]

Comments

no comments yet

YOUBLISHER
About
What Others Say
Sitemap
Impressum

PUBLISHERS
Login
Signup
Tutorials
FAQ
Support

BUSINESS
Overview
Advertising
Support

DEVELOPERS
API

LEGAL
Report a Copyright Violation
Copyright FAQ
Terms of Use
Privacy Policy