Preface
1.HelloJavaScript!
HelloWorld!
HelloWorld!OnceAgain
ThescriptTag
JavaScriptVersusECMAScriptVersusJScript
DefiningFunctionsinJavaScript
EventHandlers
ThedocumentBrowserObject
ThepropertyOperator
ThevarKeywordandScope
Statements
Comments
WhatYouDidntSee:HTMLCommentsandCDATASections
JavaScriptFiles
AccessibilityandJavaScriptBestPractices
AccessibilityGuidelines
noscript
2.JavaScriptDataTypesandVariables
IdentifyingVariables
NamingGuidelines
PrimitiveTypes
TheStringDataType
StringEscapeSequences
StringEncoding
ConvertingtoStrings
TheBooleanDataType
TheNumberDataType
ThenullandundefinedVariables
Constants:NamedbutNotVariables
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
3.OperatorsandStatements
TheFormatofaJavaScriptStatement
TheAssignmentStatement
TheArithmeticOperators
TheUnaryOperators
OperatorPrecedence
AHandyShortcut:AssignmentwithOperation
TheBitwiseOperators
ConditionalStatementsandProgramFlow
Theif...elseConditionalStatement
TheswitchConditionalStatement
TheConditionalOperators
TheEqualityandIdentity(StringEquality)Operators
OtherRelationalOperators
TheOneandOnlyJavaScriptTernaryOperator
TheLogicalOperators
AdvancedStatements:TheLoops
ThewhileLoop
Thedo...whileLoop
TheforLoops
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
4.TheJavaScriptObjects
PrimitiveDataTypesAsObjects
Boolean,Number,andString
TheBooleanObject
TheNumberObject,StaticProperties,andInstanceMethods
TheStringObject
RegularExpressionsandRegExp
TheRegExpMethods:testandexec
WorkingwithRegularExpressions
TheDateObject
TheMathObject
TheMathProperties
TheMathMethods
JavaScriptArrays
FIFOQueues
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
5.Functions
DeclarativeFunctions
FunctionNamingConventionsandSize
FunctionReturnsandArguments
AnonymousFunctions
FunctionLiterals
FunctionsandRecursion
NestedFunctions,FunctionClosure,andMemoryLeaks
CallbackFunctions
FunctionTypeSummary
FunctionScope
FunctionAsObject
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
6.Troubleshooting,Debugging,andCross-BrowserIssues
SimpleWaystoDebug
DevelopmentandDebuggingToolsbyBrowser
FirefoxandFirebug
Usingconsole.log
Firefox,theWebDeveloperToolkit,andNoScript
OperaandDragonfly
Safari/WebKitandtheWebInspector
InternetExplorer
DealingwithCross-BrowserDifferences
ObjectDetection
WhereObjectDetectionFails
DOCTYPE,X-UA-Compatible,andQuirksMode
BreakingBackwardCompatibility:TheIE8http-equivMetaTag
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
7.CatchingEvents
TheEvents
Level0EventHandling
TheEventObject
EventBubbling
EventHandlersandthis
TheDOMLevel2EventModel
GeneratingEvents
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
8.Forms,FormEvents,andValidation
AttachingEventstoForms:DifferentApproaches
Cross-BrowserEventHandling
CancelinganEvent
Selection
DynamicallyModifyingtheSelection
SelectionandAuto-Selection
RadioButtonsandCheckboxes
Thetext,textarea,password,andhiddenInputElements
TextValidation
InputFieldsandRegularExpressionValidation
Forms,theSandbox,andXSS
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
9.BrowserAsPuzzleBox
TheStructureoftheBrowserataGlance
ThewindowObject
CreatingandControllingWindows
TheDialogs:alert,confirm,andprompt
CreatingCustomWindows
ModifyingaWindow
Frames
ThelocationObject
RemoteScriptingwiththeiframe
AddingandControllingTimers
Thehistory,screen,andnavigatorObjects
ThehistoryObject
ThescreenObject
ThenavigatorObject
Thehistory,screen,andnavigatorPropertiesinAction
TheDocumentObject
Links
Images
innerHTML
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
10.CookiesandOtherClient-SideStorageTechniques
TheJavaScriptSandboxandCookieSecurity
TheSame-OriginSecurityPolicy
Usingdocument.domain
AllAboutCookies
StoringandReadingCookies
FlashSharedObjects,GoogleGears,andHTML5DOMStorage
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
11.TheDOM,orWebPageAsTree
ATaleofTwoInterfaces
TheDOMHTMLAPl
TheDOMHTMLObjectsandTheirProperties
DOM(HTML).Collections
UnderstandingtheDOM:TheCoreAPl
TheDOMTree
NodePropertiesandMethods
TheDOMCoreDocumentObject
ElementandAccessinContext
ModifyingtheTree
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
12.DynamicPages
JavaScript,CSS,andtheDOM
TheStyleProperty/Attributes
FontsandText
FontStyleProperties
TextProperties
PositionandMovement
DynamicPositioning
Drag-and-Drop
SizeandClipping
OverflowandDynamicContent
TheClippingRectangle
Display,Visibility,andOpacity
TheRightToolfortheRightEffect
Just-in-TimeInformation
RevisitingtheDOM:CollapsingForms,QuerySelectors,andClassNames
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
13.CreatingCustomJavaScriptObjects
TheJavaScriptObjectandPrototyping
Prototyping
CreatingYourOwnCustomJavaScriptObjects
EntertheFunction
PublicandPrivatePropertiesandWherethisEntersthePicture
GettersandSetters
ObjectEncapsulation
ChainingConstructorsandJavaScriptInheritance
One-OffObjects
ObjectLibraries:PackagingYourObjectsforReuse
AdvancedErrorHandlingTechniques(try,throw,catch)
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
14.MovingOutsidethePagewithAjax
HowAjaxWorks
HelloAjaxWorld!
TheXMLHttpRequestObjectandPreparingtoSendtheRequest
Object,Object,WhoHastheObject?
TheXMLHttpRequestMethods
ProcessingtheWebRequestReturn
CheckingthereadyStateandstatusofanAjaxRequest
ProcessingtheWebRequestResult
Ajax:ItsNotOnlyCode
TheDynamicNatureofAjax
AjaxAccessibilityandDegradingGracefully
SecurityandWorkarounds
JavaScriptandAjaxLibraries
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
15.AjaxData:XMLorJSON?
XML-FormattedAjaxResults
TheDatasMIMEType
GeneratingtheXMLontheServer
ProcessingtheXMLontheClient
JavaScriptObjectNotation
ASimpleJSONApplication
TheJSONObject
TestYourKnowledge:Quiz
TestYourKnowledge:Answers
Index