JavaScript: The Definitive Guide



Price: $31.49


JavaScript: The Definitive Guide (O'Reilly Media, Inc.) - August 2006Publisher: O'Reilly Media, Inc. - August 17, 2006

ISBN-10: 0596101996, ISBN-13: 9780596101992

Author: David Flanagan


1018 pages

One of the top-selling books




Book Description
Since the earliest days of Internet scripting, Web developers have considered JavaScript: The Definitive Guide an essential resource. David Flanagan's approach, which combines tutorials and examples with easy-to-use syntax guides and object references, suits the typical programmer's requirements nicely. The brand-new fourth edition of Flanagan's "Rhino Book" includes coverage of JavaScript 1.5, JScript 5.5, ECMAScript 3, and the Document Object Model (DOM) Level 2 standard from the World Wide Web Consortium (W3C). Interestingly, the author has shifted away from specifying--as he did in earlier editions--what browsers support each bit of the language. Rather than say Netscape 3.0 supports the Image object while Internet Explorer 3.0 does not, he specifies that JavaScript 1.1 and JScript 3.0 support Image. More usefully, he specifies the contents of independent standards like ECMAScript, which encourages scripters to write applications for these standards and browser vendors to support them. As Flanagan says, JavaScript and its related subjects are very complex in their pure forms. It's impossible to keep track of the differences among half a dozen vendors' generally similar implementations. Nonetheless, a lot of examples make reference to specific browsers' capabilities.

Though he does not cover server-side APIs, Flanagan has chosen to separate coverage of core JavaScript (all the keywords, general syntax, and utility objects like Array) from coverage of client-side JavaScript (which includes objects, like History and Event, that have to do with Web browsers and users' interactions with them. This approach makes this book useful to people using JavaScript for applications other than Web pages. By the way, the other classic JavaScript text--Danny Goodman's JavaScript Bible--isn't as current as this book, but it's still a fantastic (and perhaps somewhat more novice-friendly) guide to the JavaScript language and its capabilities. --David Wall

Topics covered: The JavaScript language (version 1.0 through version 1.5) and its relatives, JScript and ECMAScript, as well as the W3C DOM standards they're often used to manipulate. Tutorial sections show how to program in JavaScript, while reference sections summarize syntax and options while providing copious code examples.This Fifth Edition is completely revised and expanded to cover JavaScript as it is used in today's Web 2.0 applications. This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including: Scripted HTTP and Ajax XML processing Client-side graphics using the canvas tag Namespaces in JavaScript--essential when writing complex programs Classes, closures, persistence, Flash, and JavaScript embedded in Java applications

Part I explains the core JavaScript language in detail. If you are new to JavaScript, it will teach you the language. If you are already a JavaScript programmer, Part I will sharpen your skills and deepen your understanding of the language.

Part II explains the scripting environment provided by web browsers, with a focus on DOM scripting with unobtrusive JavaScript. The broad and deep coverage of client-side JavaScript is illustrated with many sophisticated examples that demonstrate how to: Generate a table of contents for an HTML document Display DHTML animations Automate form validation Draw dynamic pie charts Make HTML elements draggable Define keyboard shortcuts for web applications Create Ajax-enabled tool tips Use XPath and XSLT on XML documents loaded with Ajax And much more

Part III is a complete reference for core JavaScript. It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript Version 3.

Part IV is a reference for client-side JavaScript, covering legacy web browser APIs, the standard Level 2 DOM API, and emerging standards such as the XMLHttpRequestobject and the canvas tag.

More than 300,000 JavaScript programmers around the world have made this their indispensable reference book for building JavaScript applications.

""A must-have reference for expert JavaScript programmers...well-organized and detailed."" -- Brendan Eich, creator of JavaScript



Table of Contents Summary

Chapter 1. Introduction to JavaScript
JavaScript Myths, Versions of JavaScript, Client-Side JavaScript, JavaScript in Other Contexts, Client-Side JavaScript: Executable Content in Web Pages, Client-Side JavaScript Features, JavaScript Security, Example: Computing Loan Payments with JavaScript, Using the Rest of This Book, Exploring JavaScript

Part I: Core JavaScript
Chapter 2. Lexical Structure
Character Set, Case Sensitivity, Whitespace and Line Breaks, Optional Semicolons, Comments, Literals, Identifiers, Reserved Words

Chapter 3. Data Types and Values
Numbers, Strings, Boolean Values, Functions, Objects, Arrays, null, undefined, The Date Object, Regular Expressions, Error Objects, Primitive Data Type Wrapper Objects

Chapter 4. Variables
Variable Typing, Variable Declaration, Variable Scope, Primitive Types and Reference Types, Garbage Collection, Variables as Properties, Variable Scope Revisited

Chapter 5. Expressions and Operators
Expressions, Operator Overview, Arithmetic Operators, Equality Operators, Relational Operators, String Operators, Logical Operators, Bitwise Operators
Assignment Operators, Miscellaneous Operators

Chapter 6. Statements
Expression Statements, Compound Statements, if, else if, switch, while, do/while, for, for/in, Labels, break, continue, var, function, return, throw, try/catch/finally
with, The Empty Statement, Summary of JavaScript Statements

Chapter 7. Functions
Defining and Invoking Functions, Functions as Data, Function Scope: The Call Object, Function Arguments: The Arguments Object, Function Properties and Methods

Chapter 8. Objects
Objects and Properties, Constructors, Methods, Prototypes and Inheritance, Object-Oriented JavaScript, Objects as Associative Arrays, Object Properties and Methods

Chapter 9. Arrays
Arrays and Array Elements, Array Methods

Chapter 10. Pattern Matching with Regular Expressions
Defining Regular Expressions, String Methods for Pattern Matching, The RegExp Object

Chapter 11. Further Topics in JavaScript
Data Type Conversion, By Value Versus by Reference, Garbage Collection, Lexical Scoping and Nested Functions, The Function( ) Constructor and Function Literals, Netscape's JavaScript 1.2 Incompatibilities


Part II: Client-Side JavaScript
Chapter 12. JavaScript in Web Browsers, The Web Browser Environment, Embedding JavaScript in HTML, Execution of JavaScript Programs,

Chapter 13. Windows and Frames
Window Overview, Simple Dialog Boxes, The Status Line, Timeouts and Intervals, Error Handling, The Navigator Object, The Screen Object, Window Control Methods, The Location Object, The History Object, Multiple Windows and Frames

Chapter 14. The Document Object
Document Overview, Dynamically Generated Documents, Document Color Properties, Document Information Properties, Forms, Images, Links, Anchors
Applets, Embedded Data

Chapter 15. Forms and Form Elements
The Form Object, Defining Form Elements, Scripting Form Elements, Form Verification Example

Chapter 16. Scripting Cookies
An Overview of Cookies, Storing Cookies, Reading Cookies, Cookie Example

Chapter 17. The Document Object Model
An Overview of the DOM, Using the Core DOM API, DOM Compatibility with Internet Explorer 4, DOM Compatibility with Netscape 4, Convenience Methods: The Traversal and Range APIs

Chapter 18. Cascading Style Sheets and Dynamic HTML
Styles and Style Sheets with CSS, Element Positioning with CSS, Scripting Styles, DHTML in Fourth-Generation Browsers, Other DOM APIs for Styles and Style Sheets

Chapter 19. Events and Event Handling
Basic Event Handling, Advanced Event Handling with DOM Level 2, The Internet Explorer Event Model, The Netscape 4 Event Model

Chapter 20. Compatibility Techniques
Platform and Browser Compatibility, Language Version Compatibility, Compatibility with Non-JavaScript Browsers

Chapter 21. JavaScript Security
JavaScript and Security, Restricted Features, The Same-Origin Policy, Security Zones and Signed Scripts

Chapter 22. Using Java with JavaScript
Scripting Java Applets, Using JavaScript from Java, Using Java Classes Directly, LiveConnect Data Types, LiveConnect Data Conversion, JavaScript Conversion of JavaObjects, Java-to-JavaScript Data Conversion


Part III: Core JavaScript Reference
Chapter 23. Core JavaScript Reference, Sample Entry, arguments[ ], Arguments, Arguments.callee, Arguments.length, Array, Array.concat( ), Array.join( ), Array.length, Array.pop( ), Array.push( ), Array.reverse( ), Array.shift( ), Array.slice( ), Array.sort( ), Array.splice( ), Array.toLocaleString( ), Array.toString( ), Array.unshift( ), Boolean, Boolean.toString( ), Boolean.valueOf( ), Date, Date.getDate( ), Date.getDay( ), Date.getFullYear( ), Date.getHours( ), Date.getMilliseconds( ), Date.getMinutes( ), Date.getMonth( ), Date.getSeconds( ), Date.getTime( ), Date.getTimezoneOffset( ), Date.getUTCDate( ), Date.getUTCDay( ), Date.getUTCFullYear( ), Date.getUTCHours( ), Date.getUTCMilliseconds( ), Date.getUTCMinutes( ), Date.getUTCMonth( ), Date.getUTCSeconds( ), Date.getYear( ), Date.parse( ), Date.setDate( ), Date.setFullYear( ), Date.setHours( ), Date.setMilliseconds( ), Date.setMinutes( ), Date.setMonth( ), Date.setSeconds( ), Date.setTime( ), Date.setUTCDate( ), Date.setUTCFullYear( ), Date.setUTCHours( ), Date.setUTCMilliseconds( ), Date.setUTCMinutes( ), Date.setUTCMonth( ), Date.setUTCSeconds( ), Date.setYear( ), Date.toDateString( ), Date.toGMTString( ), Date.toLocaleDateString( ), Date.toLocaleString( ) , Date.toLocaleTimeString( ), Date.toString( ), Date.toTimeString( ), Date.toUTCString( ), Date.UTC( ), Date.valueOf( ), decodeURI( ), decodeURIComponent( ), encodeURI( ), encodeURIComponent( ), Error, Error.message, Error.name, Error.toString( ), escape( ), eval( ), EvalError, Function,  Function.apply( ), Function.arguments[], Function.call( ), Function.caller, Function.length, Function.prototype, Function.toString( ), Global, Infinity, isFinite( ), isNaN( ), Math, Math.abs( ), Math.acos( ), Math.asin( ), Math.atan( ), Math.atan2( ), Math.ceil( ), Math.cos( ), Math.E, Math.exp( ), Math.floor( ), Math.LN10, Math.LN2, Math.log( ), Math.LOG10E, Math.LOG2E, Math.max( ), Math.min( ), Math.PI, Math.pow( ), Math.random( ), Math.round( ), Math.sin( ), Math.sqrt( ), Math.SQRT1_2 , Math.SQRT2, Math.tan( ), NaN, Number, Number.MAX_VALUE, Number.MIN_VALUE, Number.NaN, Number.NEGATIVE_INFINITY,  Number.POSITIVE_INFINITY, Number.toExponential( ), Number.toFixed( ), Number.toLocaleString( ), Number.toPrecision( ), Number.toString( ), Number.valueOf( ), Object, Object.constructor, Object.hasOwnProperty( ), Object.isPrototypeOf( ), Object.propertyIsEnumerable( ), Object.toLocaleString( ),  Object.toString( ), Object.valueOf( ), parseFloat( ), parseInt( ), RangeError, ReferenceError, RegExp, RegExp.exec( ), RegExp.global, RegExp.ignoreCase, RegExp.lastIndex, RegExp.source, RegExp.test( ), RegExp.toString( ), String, String.charAt( ), String.charCodeAt( ), String.concat( ), String.fromCharCode( ), String.indexOf( ), String.lastIndexOf( ), String.length, String.localeCompare( ), String.match( ), String.replace( ), String.search( ), String.slice( ), String.split( ), String.substr( ), String.substring( ), String.toLocaleLowerCase( ), String.toLocaleUpperCase( ), String.toLowerCase( ), String.toString( ), String.toUpperCase( ), String.valueOf( ), SyntaxError, TypeError, undefined, unescape( ), URIError


Part IV: Client-Side JavaScript Reference
Chapter 24. Client-Side JavaScript Reference
Sample Entry, Anchor, Applet, Area, Button, Button.onclick, Checkbox, Checkbox.onclick, Document, Document.all[], Document.captureEvents( ), Document.clear( ), Document.close( ), Document.cookie, Document.domain, Document.elementFromPoint( ), Document.getSelection( ), Document.handleEvent( ), Document.lastModified, Document.links[], Document.open( ), Document.releaseEvents( ), Document.routeEvent( ), Document.URL, Document.write( ), Document.writeln( ), Element, Event, FileUpload, FileUpload.onchange, Form, Form.elements[], Form.onreset, Form.onsubmit, Form.reset( ), Form.submit( ), Form.target, Frame, getClass( ), Hidden, History, History.back( ), History.forward( ), History.go( ), HTMLElement ,HTMLElement.contains( ), HTMLElement.getAttribute( ), HTMLElement.handleEvent( ), HTMLElement.insertAdjacentHTML( ), HTMLElement.insertAdjacentText( ), HTMLElement.onclick, HTMLElement.ondblclick, HTMLElement.onhelp, HTMLElement.onkeydown, HTMLElement.onkeypress, HTMLElement.onkeyup, HTMLElement.onmousedown, HTMLElement.onmousemove, HTMLElement.onmouseout, HTMLElement.onmouseover, HTMLElement.onmouseup, HTMLElement.removeAttribute( ), HTMLElement.scrollIntoView( ), HTMLElement.setAttribute( ), Image, Image.onabort, Image.onerror, Image.onload, Input, Input.blur( ), Input.click( ), Input.focus( ) , Input.name, Input.onblur, Input.onchange, Input.onclick, Input.onfocus, Input.select( ), Input.type, Input.value, JavaArray, JavaClass, JavaObject, JavaPackage, JSObject, JSObject.call( ), JSObject.eval( ), JSObject.getMember( ), JSObject.getSlot( ), JSObject.getWindow( ), JSObject.removeMember( ), JSObject.setMember( ), JSObject.setSlot( ), JSObject.toString( ), Layer, Layer.captureEvents( ), Layer.handleEvent( ), Layer.load( ), Layer.moveAbove( ), Layer.moveBelow( ), Layer.moveBy( ), Layer.moveTo( ), Layer.moveToAbsolute( ), Layer.offset( ), Layer.releaseEvents( ), Layer.resizeBy( ), Layer.resizeTo( ), Layer.routeEvent( ), Link, Link.onclick, Link.onmouseout, Link.onmouseover, Link.target, Location, Location.reload( ), Location.replace( ), MimeType, Navigator, Navigator.javaEnabled( ), Navigator.plugins.refresh( ), Option, Password, Plugin, Radio, Radio.onclick, Reset, Reset.onclick, Screen, Select, Select.onchange, Select.options[], Style, Submit, Submit.onclick, Text, Text.onchange, Textarea, Textarea.onchange, URL, Window, Window.alert( ), Window.back( ), Window.blur( ) , Window.captureEvents( ), Window.clearInterval( ), Window.clearTimeout( ), Window.close( ), Window.confirm( ), Window.defaultStatus, Window.focus( ), Window.forward( ), Window.handleEvent( ), Window.home( ), Window.moveBy( ), Window.moveTo( ), Window.name, Window.navigate( ),  Window.onblur, Window.onerror, Window.onfocus, Window.onload, Window.onmove, Window.onresize, Window.onunload, Window.open( ), Window.print( ), Window.prompt( ), Window.releaseEvents( ), Window.resizeBy( ), Window.resizeTo( ), Window.routeEvent( ), Window.scroll( ), Window.scrollBy( ), Window.scrollTo( ), Window.setInterval( ), Window.setTimeout( ), Window.status, Window.stop( )


Part V: W3C DOM Reference
Chapter 25. W3C DOM Reference, Sample Entry, AbstractView, AbstractView.getComputedStyle( ), Attr, CDATASection, CharacterData, CharacterData.appendData( ), CharacterData.deleteData( ), CharacterData.insertData( ), CharacterData.replaceData( ), CharacterData.substringData( ),
Comment, Counter, CSS2Properties, CSSCharsetRule, CSSFontFaceRule, CSSImportRule, CSSMediaRule, CSSMediaRule.deleteRule( ), CSSMediaRule.insertRule( ), CSSPageRule, CSSPrimitiveValue, CSSPrimitiveValue.getCounterValue( ), CSSPrimitiveValue.getFloatValue( ), CSSPrimitiveValue.getRectValue( ), CSSPrimitiveValue.getRGBColorValue( ), CSSPrimitiveValue.getStringValue( ), CSSPrimitiveValue.setFloatValue( ), CSSPrimitiveValue.setStringValue( ), CSSRule, CSSRuleList, CSSRuleList.item( ), CSSStyleDeclaration, CSSStyleDeclaration.getPropertyCSSValue( ) , CSSStyleDeclaration.getPropertyPriority( ), CSSStyleDeclaration.getPropertyValue( ), CSSStyleDeclaration.item( ), CSSStyleDeclaration.removeProperty( ), CSSStyleDeclaration.setProperty( ), CSSStyleRule, CSSStyleSheet, CSSStyleSheet.deleteRule( ), CSSStyleSheet.insertRule( ), CSSUnknownRule, CSSValue, CSSValueList, CSSValueList.item( ), Document, Document.createAttribute( ), Document.createAttributeNS( ), Document.createCDATASection( ), Document.createComment( ), Document.createDocumentFragment( ), Document.createElement( ), Document.createElementNS( ), Document.createEntityReference( ), Document.createEvent( ), Document.createNodeIterator( ), Document.createProcessingInstruction( ), Document.createRange( ), Document.createTextNode( ), Document.createTreeWalker( ), Document.getElementById( ), Document.getElementsByTagName( ), Document.getElementsByTagNameNS( ), Document.getOverrideStyle( ), Document.importNode( ), DocumentCSS, DocumentEvent, DocumentFragment, DocumentRange, DocumentStyle, DocumentTraversal, DocumentType, DocumentView, DOMException, DOMImplementation, DOMImplementation.createCSSStyleSheet( ), DOMImplementation.createDocument( ), DOMImplementation.createDocumentType( ), DOMImplementation.createHTMLDocument( ), DOMImplementation.hasFeature( ), DOMImplementationCSS, Element, Element.getAttribute( ), Element.getAttributeNode( ), Element.getAttributeNodeNS( ), Element.getAttributeNS( ), Element.getElementsByTagName( ), Element.getElementsByTagNameNS( ), Element.hasAttribute( ), Element.hasAttributeNS( ), Element.removeAttribute( ), Element.removeAttributeNode( ), Element.removeAttributeNS( ), Element.setAttribute( ), Element.setAttributeNode( ), Element.setAttributeNodeNS( ), Element.setAttributeNS( ), ElementCSSInlineStyle, Entity, EntityReference, Event, Event.initEvent( ), Event.preventDefault( ), Event.stopPropagation( ), EventException, EventListener, EventTarget, EventTarget.addEventListener( ), EventTarget.dispatchEvent( ), EventTarget.removeEventListener( ), HTMLAnchorElement, HTMLAnchorElement.blur( ), HTMLAnchorElement.focus( ), HTMLBodyElement, HTMLCollection, HTMLCollection.item( ), HTMLCollection.namedItem( ), HTMLDocument, HTMLDocument.close( ), HTMLDocument.getElementById( ), HTMLDocument.getElementsByName( ), HTMLDocument.open( ), HTMLDocument.write( ), HTMLDocument.writeln( ), HTMLDOMImplementation, HTMLElement, HTMLFormElement, HTMLFormElement.reset( ), HTMLFormElement.submit( ), HTMLInputElement, HTMLInputElement.blur( ), HTMLInputElement.click( ), HTMLInputElement.focus( ), HTMLInputElement.select( ), HTMLOptionElement, HTMLSelectElement, HTMLSelectElement.add( ), HTMLSelectElement.blur( ), HTMLSelectElement.focus( ), HTMLSelectElement.remove( ), HTMLTableCaptionElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement, HTMLTableElement.createCaption( ), HTMLTableElement.createTFoot( ), HTMLTableElement.createTHead( ), HTMLTableElement.deleteCaption( ) , HTMLTableElement.deleteRow( ), HTMLTableElement.deleteTFoot( ), HTMLTableElement.deleteTHead( ), HTMLTableElement.insertRow( ), HTMLTableRowElement, HTMLTableRowElement.deleteCell( ) , HTMLTableRowElement.insertCell( ), HTMLTableSectionElement , HTMLTableSectionElement.deleteRow( ), HTMLTableSectionElement.insertRow( ) , HTMLTextAreaElement, HTMLTextAreaElement.blur( ), HTMLTextAreaElement.focus( ), HTMLTextAreaElement.select( ), LinkStyle, MediaList, MediaList.appendMedium( ), MediaList.deleteMedium( ), MediaList.item( ) , MouseEvent, MouseEvent.initMouseEvent( ), MutationEvent, MutationEvent.initMutationEvent( ), NamedNodeMap, NamedNodeMap.getNamedItem( ), NamedNodeMap.getNamedItemNS( ), NamedNodeMap.item( ), NamedNodeMap.removeNamedItem( ), NamedNodeMap.removeNamedItemNS( ), NamedNodeMap.setNamedItem( ), NamedNodeMap.setNamedItemNS( ), Node, Node.appendChild( ), Node.cloneNode( ), Node.hasAttributes( ), Node.ChildNodes( ) , Node.insertBefore( ), Node.isSupported( ), Node.normalize( ), Node.removeChild( ), Node.replaceChild( ), NodeFilter, NodeIterator, NodeIterator.detach( ), NodeIterator.nextNode( ), NodeIterator.previousNode( ), NodeList, NodeList.item( ), Notation, ProcessingInstruction, Range, Range.cloneContents( ), Range.cloneRange( ), Range.collapse( ), Range.compareBoundaryPoints( ), Range.deleteContents( ), Range.detach( ), Range.extractContents( ), Range.insertNode( ), Range.selectNode( ), Range.selectNodeContents( ), Range.setEnd( ), Range.setEndAfter( ), Range.setEndBefore( ), Range.setStart( ), Range.setStartAfter( ), Range.setStartBefore( ), Range.surroundContents( ), Range.toString( ), RangeException, Rect, RGBColor, StyleSheet, StyleSheetList, StyleSheetList.item( ), Text, Text.splitText( ), TreeWalker, TreeWalker.firstChild( ), TreeWalker.lastChild( ), TreeWalker.nextNode( ), TreeWalker.nextSibling( ), TreeWalker.parentNode( ), TreeWalker.previousNode( ), TreeWalker.previousSibling( ), UIEvent, UIEvent.initUIEvent( ), ViewCSS


Part VI: Class, Property, Method, and Event Handler Index
Chapter 26. Class, Property, Method, and Event Handler Index