CoverTable of ContentsDedicationCopyrightPrefaceWhat's New in the Fourth EditionConventions Used in This BookErrataFinding the Examples OnlineComments and QuestionsAcknowledgmentsChapter 1. Introduction to JavaScriptSection 1.1. JavaScript MythsSection 1.2. Versions of JavaScriptSection 1.3. Client-Side JavaScriptSection 1.4. JavaScript in Other ContextsSection 1.5. Client-Side JavaScript: Executable Content in Web PagesSection 1.6. Client-Side JavaScript FeaturesSection 1.7. JavaScript SecuritySection 1.8. Example: Computing Loan Payments with JavaScriptSection 1.9. Using the Rest of This BookSection 1.10. Exploring JavaScriptPart I: Core JavaScriptChapter 2. Lexical StructureSection 2.1. Character SetSection 2.2. Case SensitivitySection 2.3. Whitespace and Line BreaksSection 2.4. Optional SemicolonsSection 2.5. CommentsSection 2.6. LiteralsSection 2.7. IdentifiersSection 2.8. Reserved WordsChapter 3. Data Types and ValuesSection 3.1. NumbersSection 3.2. StringsSection 3.3. Boolean ValuesSection 3.4. FunctionsSection 3.5. ObjectsSection 3.6. ArraysSection 3.7. nullSection 3.8. undefinedSection 3.9. The Date ObjectSection 3.10. Regular ExpressionsSection 3.11. Error ObjectsSection 3.12. Primitive Data Type Wrapper ObjectsChapter 4. VariablesSection 4.1. Variable TypingSection 4.2. Variable DeclarationSection 4.3. Variable ScopeSection 4.4. Primitive Types and Reference TypesSection 4.5. Garbage CollectionSection 4.6. Variables as PropertiesSection 4.7. Variable Scope RevisitedChapter 5. Expressions and OperatorsSection 5.1. ExpressionsSection 5.2. Operator OverviewSection 5.3. Arithmetic OperatorsSection 5.4. Equality OperatorsSection 5.5. Relational OperatorsSection 5.6. String OperatorsSection 5.7. Logical OperatorsSection 5.8. Bitwise OperatorsSection 5.9. Assignment OperatorsSection 5.10. Miscellaneous OperatorsChapter 6. StatementsSection 6.1. Expression StatementsSection 6.2. Compound StatementsSection 6.3. ifSection 6.4. else ifSection 6.5. switchSection 6.6. whileSection 6.7. do/whileSection 6.8. forSection 6.9. for/inSection 6.10. LabelsSection 6.11. breakSection 6.12. continueSection 6.13. varSection 6.14. functionSection 6.15. returnSection 6.16. throwSection 6.17. try/catch/finallySection 6.18. withSection 6.19. The Empty StatementSection 6.20. Summary of JavaScript StatementsChapter 7. FunctionsSection 7.1. Defining and Invoking FunctionsSection 7.2. Functions as DataSection 7.3. Function Scope: The Call ObjectSection 7.4. Function Arguments: The Arguments ObjectSection 7.5. Function Properties and MethodsChapter 8. ObjectsSection 8.1. Objects and PropertiesSection 8.2. ConstructorsSection 8.3. MethodsSection 8.4. Prototypes and InheritanceSection 8.5. Object-Oriented JavaScriptSection 8.6. Objects as Associative ArraysSection 8.7. Object Properties and MethodsChapter 9. ArraysSection 9.1. Arrays and Array ElementsSection 9.2. Array MethodsChapter 10. Pattern Matching with Regular ExpressionsSection 10.1. Defining Regular ExpressionsSection 10.2. String Methods for Pattern MatchingSection 10.3. The RegExp ObjectChapter 11. Further Topics in JavaScriptSection 11.1. Data Type ConversionSection 11.2. By Value Versus by ReferenceSection 11.3. Garbage CollectionSection 11.4. Lexical Scoping and Nested FunctionsSection 11.5. The Function( ) Constructor and Function LiteralsSection 11.6. Netscape's JavaScript 1.2 IncompatibilitiesPart II: Client-Side JavaScriptChapter 12. JavaScript in Web BrowsersSection 12.1. The Web Browser EnvironmentSection 12.2. Embedding JavaScript in HTMLSection 12.3. Execution of JavaScript ProgramsChapter 13. Windows and FramesSection 13.1. Window OverviewSection 13.2. Simple Dialog BoxesSection 13.3. The Status LineSection 13.4. Timeouts and IntervalsSection 13.5. Error HandlingSection 13.6. The Navigator ObjectSection 13.7. The Screen ObjectSection 13.8. Window Control MethodsSection 13.9. The Location ObjectSection 13.10. The History ObjectSection 13.11. Multiple Windows and FramesChapter 14. The Document ObjectSection 14.1. Document OverviewSection 14.2. Dynamically Generated DocumentsSection 14.3. Document Color PropertiesSection 14.4. Document Information PropertiesSection 14.5. FormsSection 14.6. ImagesSection 14.7. LinksSection 14.8. AnchorsSection 14.9. AppletsSection 14.10. Embedded DataChapter 15. Forms and Form ElementsSection 15.1. The Form ObjectSection 15.2. Defining Form ElementsSection 15.3. Scripting Form ElementsSection 15.4. Form Verification ExampleChapter 16. Scripting CookiesSection 16.1. An Overview of CookiesSection 16.2. Storing CookiesSection 16.3. Reading CookiesSection 16.4. Cookie ExampleChapter 17. The Document Object ModelSection 17.1. An Overview of the DOMSection 17.2. Using the Core DOM APISection 17.3. DOM Compatibility with Internet Explorer 4Section 17.4. DOM Compatibility with Netscape 4Section 17.5. Convenience Methods: The Traversal and Range APIsChapter 18. Cascading Style Sheets and Dynamic HTMLSection 18.1. Styles and Style Sheets with CSSSection 18.2. Element Positioning with CSSSection 18.3. Scripting StylesSection 18.4. DHTML in Fourth-Generation BrowsersSection 18.5. Other DOM APIs for Styles and Style SheetsChapter 19. Events and Event HandlingSection 19.1. Basic Event HandlingSection 19.2. Advanced Event Handling with DOM Level 2Section 19.3. The Internet Explorer Event ModelSection 19.4. The Netscape 4 Event ModelChapter 20. Compatibility TechniquesSection 20.1. Platform and Browser CompatibilitySection 20.2. Language Version CompatibilitySection 20.3. Compatibility with Non-JavaScript BrowsersChapter 21. JavaScript SecuritySection 21.1. JavaScript and SecuritySection 21.2. Restricted FeaturesSection 21.3. The Same-Origin PolicySection 21.4. Security Zones and Signed ScriptsChapter 22. Using Java with JavaScriptSection 22.1. Scripting Java AppletsSection 22.2. Using JavaScript from JavaSection 22.3. Using Java Classes DirectlySection 22.4. LiveConnect Data TypesSection 22.5. LiveConnect Data ConversionSection 22.6. JavaScript Conversion of JavaObjectsSection 22.7. Java-to-JavaScript Data ConversionPart III: Core JavaScript ReferenceChapter 23. Core JavaScript ReferenceSample Entryarguments[ ]ArgumentsArguments.calleeArguments.lengthArrayArray.concat( )Array.join( )Array.lengthArray.pop( )Array.push( )Array.reverse( )Array.shift( )Array.slice( )Array.sort( )Array.splice( )Array.toLocaleString( )Array.toString( )Array.unshift( )BooleanBoolean.toString( )Boolean.valueOf( )DateDate.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( )ErrorError.messageError.nameError.toString( )escape( )eval( )EvalErrorFunctionFunction.apply( )Function.arguments[]Function.call( )Function.callerFunction.lengthFunction.prototypeFunction.toString( )GlobalInfinityisFinite( )isNaN( )MathMath.abs( )Math.acos( )Math.asin( )Math.atan( )Math.atan2( )Math.ceil( )Math.cos( )Math.EMath.exp( )Math.floor( )Math.LN10Math.LN2Math.log( )Math.LOG10EMath.LOG2EMath.max( )Math.min( )Math.PIMath.pow( )Math.random( )Math.round( )Math.sin( )Math.sqrt( )Math.SQRT1_2Math.SQRT2Math.tan( )NaNNumberNumber.MAX_VALUENumber.MIN_VALUENumber.NaNNumber.NEGATIVE_INFINITYNumber.POSITIVE_INFINITYNumber.toExponential( )Number.toFixed( )Number.toLocaleString( )Number.toPrecision( )Number.toString( )Number.valueOf( )ObjectObject.constructorObject.hasOwnProperty( )Object.isPrototypeOf( )Object.propertyIsEnumerable( )Object.toLocaleString( )Object.toString( )Object.valueOf( )parseFloat( )parseInt( )RangeErrorReferenceErrorRegExpRegExp.exec( )RegExp.globalRegExp.ignoreCaseRegExp.lastIndexRegExp.sourceRegExp.test( )RegExp.toString( )StringString.charAt( )String.charCodeAt( )String.concat( )String.fromCharCode( )String.indexOf( )String.lastIndexOf( )String.lengthString.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( )SyntaxErrorTypeErrorundefinedunescape( )URIErrorPart IV: Client-Side JavaScript ReferenceChapter 24. Client-Side JavaScript ReferenceSample EntryAnchorAppletAreaButtonButton.onclickCheckboxCheckbox.onclickDocumentDocument.all[]Document.captureEvents( )Document.clear( )Document.close( )Document.cookieDocument.domainDocument.elementFromPoint( )Document.getSelection( )Document.handleEvent( )Document.lastModifiedDocument.links[]Document.open( )Document.releaseEvents( )Document.routeEvent( )Document.URLDocument.write( )Document.writeln( )ElementEventFileUploadFileUpload.onchangeFormForm.elements[]Form.onresetForm.onsubmitForm.reset( )Form.submit( )Form.targetFramegetClass( )HiddenHistoryHistory.back( )History.forward( )History.go( )HTMLElementHTMLElement.contains( )HTMLElement.getAttribute( )HTMLElement.handleEvent( )HTMLElement.insertAdjacentHTML( )HTMLElement.insertAdjacentText( )HTMLElement.onclickHTMLElement.ondblclickHTMLElement.onhelpHTMLElement.onkeydownHTMLElement.onkeypressHTMLElement.onkeyupHTMLElement.onmousedownHTMLElement.onmousemoveHTMLElement.onmouseoutHTMLElement.onmouseoverHTMLElement.onmouseupHTMLElement.removeAttribute( )HTMLElement.scrollIntoView( )HTMLElement.setAttribute( )ImageImage.onabortImage.onerrorImage.onloadInputInput.blur( )Input.click( )Input.focus( )Input.nameInput.onblurInput.onchangeInput.onclickInput.onfocusInput.select( )Input.typeInput.valueJavaArrayJavaClassJavaObjectJavaPackageJSObjectJSObject.call( )JSObject.eval( )JSObject.getMember( )JSObject.getSlot( )JSObject.getWindow( )JSObject.removeMember( )JSObject.setMember( )JSObject.setSlot( )JSObject.toString( )LayerLayer.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( )LinkLink.onclickLink.onmouseoutLink.onmouseoverLink.targetLocationLocation.reload( )Location.replace( )MimeTypeNavigatorNavigator.javaEnabled( )Navigator.plugins.refresh( )OptionPasswordPluginRadioRadio.onclickResetReset.onclickScreenSelectSelect.onchangeSelect.options[]StyleSubmitSubmit.onclickTextText.onchangeTextareaTextarea.onchangeURLWindowWindow.alert( )Window.back( )Window.blur( )Window.captureEvents( )Window.clearInterval( )Window.clearTimeout( )Window.close( )Window.confirm( )Window.defaultStatusWindow.focus( )Window.forward( )Window.handleEvent( )Window.home( )Window.moveBy( )Window.moveTo( )Window.nameWindow.navigate( )Window.onblurWindow.onerrorWindow.onfocusWindow.onloadWindow.onmoveWindow.onresizeWindow.onunloadWindow.open( )Window.print( )Window.prompt( )Window.releaseEvents( )Window.resizeBy( )Window.resizeTo( )Window.routeEvent( )Window.scroll( )Window.scrollBy( )Window.scrollTo( )Window.setInterval( )Window.setTimeout( )Window.statusWindow.stop( )Part V: W3C DOM ReferenceChapter 25. W3C DOM ReferenceSample EntryAbstractViewAbstractView.getComputedStyle( )AttrCDATASectionCharacterDataCharacterData.appendData( )CharacterData.deleteData( )CharacterData.insertData( )CharacterData.replaceData( )CharacterData.substringData( )CommentCounterCSS2PropertiesCSSCharsetRuleCSSFontFaceRuleCSSImportRuleCSSMediaRuleCSSMediaRule.deleteRule( )CSSMediaRule.insertRule( )CSSPageRuleCSSPrimitiveValueCSSPrimitiveValue.getCounterValue( )CSSPrimitiveValue.getFloatValue( )CSSPrimitiveValue.getRectValue( )CSSPrimitiveValue.getRGBColorValue( )CSSPrimitiveValue.getStringValue( )CSSPrimitiveValue.setFloatValue( )CSSPrimitiveValue.setStringValue( )CSSRuleCSSRuleListCSSRuleList.item( )CSSStyleDeclarationCSSStyleDeclaration.getPropertyCSSValue( )CSSStyleDeclaration.getPropertyPriority( )CSSStyleDeclaration.getPropertyValue( )CSSStyleDeclaration.item( )CSSStyleDeclaration.removeProperty( )CSSStyleDeclaration.setProperty( )CSSStyleRuleCSSStyleSheetCSSStyleSheet.deleteRule( )CSSStyleSheet.insertRule( )CSSUnknownRuleCSSValueCSSValueListCSSValueList.item( )DocumentDocument.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( )DocumentCSSDocumentEventDocumentFragmentDocumentRangeDocumentStyleDocumentTraversalDocumentTypeDocumentViewDOMExceptionDOMImplementationDOMImplementation.createCSSStyleSheet( )DOMImplementation.createDocument( )DOMImplementation.createDocumentType( )DOMImplementation.createHTMLDocument( )DOMImplementation.hasFeature( )DOMImplementationCSSElementElement.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( )ElementCSSInlineStyleEntityEntityReferenceEventEvent.initEvent( )Event.preventDefault( )Event.stopPropagation( )EventExceptionEventListenerEventTargetEventTarget.addEventListener( )EventTarget.dispatchEvent( )EventTarget.removeEventListener( )HTMLAnchorElementHTMLAnchorElement.blur( )HTMLAnchorElement.focus( )HTMLBodyElementHTMLCollectionHTMLCollection.item( )HTMLCollection.namedItem( )HTMLDocumentHTMLDocument.close( )HTMLDocument.getElementById( )HTMLDocument.getElementsByName( )HTMLDocument.open( )HTMLDocument.write( )HTMLDocument.writeln( )HTMLDOMImplementationHTMLElementHTMLFormElementHTMLFormElement.reset( )HTMLFormElement.submit( )HTMLInputElementHTMLInputElement.blur( )HTMLInputElement.click( )HTMLInputElement.focus( )HTMLInputElement.select( )HTMLOptionElementHTMLSelectElementHTMLSelectElement.add( )HTMLSelectElement.blur( )HTMLSelectElement.focus( )HTMLSelectElement.remove( )HTMLTableCaptionElementHTMLTableCellElementHTMLTableColElementHTMLTableElementHTMLTableElement.createCaption( )HTMLTableElement.createTFoot( )HTMLTableElement.createTHead( )HTMLTableElement.deleteCaption( )HTMLTableElement.deleteRow( )HTMLTableElement.deleteTFoot( )HTMLTableElement.deleteTHead( )HTMLTableElement.insertRow( )HTMLTableRowElementHTMLTableRowElement.deleteCell( )HTMLTableRowElement.insertCell( )HTMLTableSectionElementHTMLTableSectionElement.deleteRow( )HTMLTableSectionElement.insertRow( )HTMLTextAreaElementHTMLTextAreaElement.blur( )HTMLTextAreaElement.focus( )HTMLTextAreaElement.select( )LinkStyleMediaListMediaList.appendMedium( )MediaList.deleteMedium( )MediaList.item( )MouseEventMouseEvent.initMouseEvent( )MutationEventMutationEvent.initMutationEvent( )NamedNodeMapNamedNodeMap.getNamedItem( )NamedNodeMap.getNamedItemNS( )NamedNodeMap.item( )NamedNodeMap.removeNamedItem( )NamedNodeMap.removeNamedItemNS( )NamedNodeMap.setNamedItem( )NamedNodeMap.setNamedItemNS( )NodeNode.appendChild( )Node.cloneNode( )Node.hasAttributes( )Node.hasChildNodes( )Node.insertBefore( )Node.isSupported( )Node.normalize( )Node.removeChild( )Node.replaceChild( )NodeFilterNodeIteratorNodeIterator.detach( )NodeIterator.nextNode( )NodeIterator.previousNode( )NodeListNodeList.item( )NotationProcessingInstructionRangeRange.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( )RangeExceptionRectRGBColorStyleSheetStyleSheetListStyleSheetList.item( )TextText.splitText( )TreeWalkerTreeWalker.firstChild( )TreeWalker.lastChild( )TreeWalker.nextNode( )TreeWalker.nextSibling( )TreeWalker.parentNode( )TreeWalker.previousNode( )TreeWalker.previousSibling( )UIEventUIEvent.initUIEvent( )ViewCSSPart VI: Class, Property, Method, and Event Handler IndexChapter 26. Class, Property, Method, and Event Handler IndexSection 26.1. ASection 26.2. BSection 26.3. CSection 26.4. DSection 26.5. ESection 26.6. FSection 26.7. GSection 26.8. HSection 26.9. ISection 26.10. JSection 26.11. KSection 26.12. LSection 26.13. MSection 26.14. NSection 26.15. OSection 26.16. PSection 26.17. QSection 26.18. RSection 26.19. SSection 26.20. TSection 26.21. USection 26.22. VSection 26.23. WSection 26.24. XSection 26.25. YSection 26.26. ZColophonIndexSYMBOLindex_Aindex_Bindex_Cindex_Dindex_Eindex_Findex_Gindex_Hindex_Iindex_Jindex_Kindex_Lindex_Mindex_Nindex_Oindex_Pindex_Qindex_Rindex_Sindex_Tindex_Uindex_Vindex_Windex_Xindex_Yindex_Z