JavaScript:TheDefinitiveGuide,5thEdition
ByDavidFlanagan
...............................................
Publisher:O'Reilly
PubDate:August2006
PrintISBN-10:0-596-10199-6
PrintISBN-13:978-0-59-610199-2
Pages:1018
TableofContents|Index
ThisFifthEditioniscompletelyrevisedandexpandedtocoverJavaScriptasitisusedin
today'sWeb2.0applications.Thisbookisbothanexample-drivenprogrammer'sguide
andakeep-on-your-deskreference,withnewchaptersthatexplaineverythingyouneed
toknowtogetthemostoutofJavaScript,including:
ScriptedHTTPandAjax
XMLprocessing
Client-sidegraphicsusingthe<canvas>tag
NamespacesinJavaScript--essentialwhenwritingcomplexprograms
Classes,closures,persistence,Flash,andJavaScriptembeddedinJavaapplications
PartIexplainsthecoreJavaScriptlanguageindetail.IfyouarenewtoJavaScript,itwill
teachyouthelanguage.IfyouarealreadyaJavaScriptprogrammer,PartIwillsharpen
yourskillsanddeepenyourunderstandingofthelanguage.
PartIIexplainsthescriptingenvironmentprovidedbywebbrowsers,withafocusonDOM
scriptingwithunobtrusiveJavaScript.Thebroadanddeepcoverageofclient-side
JavaScriptisillustratedwithmanysophisticatedexamplesthatdemonstratehowto:
GenerateatableofcontentsforanHTMLdocument
DisplayDHTMLanimations
Automateformvalidation
Drawdynamicpiecharts
MakeHTMLelementsdraggable
Definekeyboardshortcutsforwebapplications
CreateAjax-enabledtooltips
UseXPathandXSLTonXMLdocumentsloadedwithAjax
Andmuchmore
PartIIIisacompletereferenceforcoreJavaScript.Itdocumentseveryclass,object,
constructor,method,function,property,andconstantdefinedbyJavaScript1.5and
ECMAScriptversion3.
PartIVisareferenceforclient-sideJavaScript,coveringlegacywebbrowserAPIs,the
standardLevel2DOMAPI,andemergingstandardssuchastheXMLHttpRequestobject
andthe<canvas>tag.
Morethan300,000JavaScriptprogrammersaroundtheworldhavemade
thistheirindispensablereferencebookforbuildingJavaScriptapplications.
"Amust-havereferenceforexpertJavaScriptprogrammers...well-organizedanddetailed."
--BrendanEich,creatorofJavaScript
JavaScript:TheDefinitiveGuide,5thEdition
ByDavidFlanagan
...............................................
Publisher:O'Reilly
PubDate:August2006
PrintISBN-10:0-596-10199-6
PrintISBN-13:978-0-59-610199-2
Pages:1018
TableofContents|Index
Copyright
Dedication
Preface
Chapter1.IntroductiontoJavaScript
Section1.1.WhatIsJavaScript?
Section1.2.VersionsofJavaScript
Section1.3.Client-SideJavaScript
Section1.4.JavaScriptinOtherContexts
Section1.5.ExploringJavaScript
PartI:CoreJavaScript
Chapter2.LexicalStructure
Section2.1.CharacterSet
Section2.2.CaseSensitivity
Section2.3.WhitespaceandLineBreaks
Section2.4.OptionalSemicolons
Section2.5.Comments
Section2.6.Literals
Section2.7.Identifiers
Section2.8.ReservedWords
Chapter3.DatatypesandValues
Section3.1.Numbers
Section3.2.Strings
Section3.3.BooleanValues
Section3.4.Functions
Section3.5.Objects
Section3.6.Arrays
Section3.7.null
Section3.8.undefined
Section3.9.TheDateObject
Section3.10.RegularExpressions
Section3.11.ErrorObjects
Section3.12.TypeConversionSummary
Section3.13.PrimitiveDatatypeWrapperObjects
Section3.14.Object-to-PrimitiveConversion
Section3.15.ByValueVersusbyReference
Chapter4.Variables
Section4.1.VariableTyping
Section4.2.VariableDeclaration
Section4.3.VariableScope
Section4.4.PrimitiveTypesandReferenceTypes
Section4.5.GarbageCollection
Section4.6.VariablesasProperties
Section4.7.VariableScopeRevisited
Chapter5.ExpressionsandOperators
Section5.1.Expressions
Section5.2.OperatorOverview
Section5.3.ArithmeticOperators
Section5.4.EqualityOperators
Section5.5.RelationalOperators
Section5.6.StringOperators
Section5.7.LogicalOperators
Section5.8.BitwiseOperators
Section5.9.AssignmentOperators
Section5.10.MiscellaneousOperators
Chapter6.Statements
Section6.1.ExpressionStatements
Section6.2.CompoundStatements
Section6.3.if
Section6.4.elseif
Section6.5.switch
Section6.6.while
Section6.7.do/while
Section6.8.for
Section6.9.for/in
Section6.10.Labels
Section6.11.break
Section6.12.continue
Section6.13.var
Section6.14.function
Section6.15.return
Section6.16.throw
Section6.17.try/catch/finally
Section6.18.with
Section6.19.TheEmptyStatement
Section6.20.SummaryofJavaScriptStatements
Chapter7.ObjectsandArrays
Section7.1.CreatingObjects
Section7.2.ObjectProperties
Section7.3.ObjectsasAssociativeArrays
Section7.4.UniversalObjectPropertiesandMethods
Section7.5.Arrays
Section7.6.ReadingandWritingArrayElements
Section7.7.ArrayMethods
Section7.8.Array-LikeObjects
Chapter8.Functions
Section8.1.DefiningandInvokingFunctions
Section8.2.FunctionArguments
Section8.3.FunctionsasData
Section8.4.FunctionsasMethods
Section8.5.ConstructorFunctions
Section8.6.FunctionPropertiesandMethods
Section8.7.UtilityFunctionExamples
Section8.8.FunctionScopeandClosures
Section8.9.TheFunction()Constructor
Chapter9.Classes,Constructors,andPrototypes
Section9.1.Constructors
Section9.2.PrototypesandInheritance
Section9.3.SimulatingClassesinJavaScript
Section9.4.CommonObjectMethods
Section9.5.SuperclassesandSubclasses
Section9.6.ExtendingWithoutInheriting
Section9.7.DeterminingObjectType
Section9.8.Example:AdefineClass()UtilityMethod
Chapter10.ModulesandNamespaces
Section10.1.CreatingModulesandNamespaces
Section10.2.ImportingSymbolsfromNamespaces
Section10.3.ModuleUtilities
Chapter11.PatternMatchingwithRegularExpressions
Section11.1.DefiningRegularExpressions
Section11.2.StringMethodsforPatternMatching
Section11.3.TheRegExpObject
Chapter12.ScriptingJava
Section12.1.EmbeddingJavaScript
Section12.2.ScriptingJava
PartII:Client-SideJavaScript
Chapter13.JavaScriptinWebBrowsers
Section13.1.TheWebBrowserEnvironment
Section13.2.EmbeddingScriptsinHTML
Section13.3.EventHandlersinHTML
Section13.4.JavaScriptinURLs
Section13.5.ExecutionofJavaScriptPrograms
Section13.6.Client-SideCompatibility
Section13.7.Accessibility
Section13.8.JavaScriptSecurity
Section13.9.OtherWeb-RelatedJavaScriptEmbeddings
Chapter14.ScriptingBrowserWindows
Section14.1.Timers
Section14.2.BrowserLocationandHistory
Section14.3.ObtainingWindow,Screen,andBrowserInformation
Section14.4.OpeningandManipulatingWindows
Section14.5.SimpleDialogBoxes
Section14.6.ScriptingtheStatusLine
Section14.7.ErrorHandling
Section14.8.MultipleWindowsandFrames
Section14.9.Example:ANavigationBarinaFrame
Chapter15.ScriptingDocuments
Section15.1.DynamicDocumentContent
Section15.2.DocumentProperties
Section15.3.LegacyDOM:DocumentObjectCollections
Section15.4.OverviewoftheW3CDOM
Section15.5.TraversingaDocument
Section15.6.FindingElementsinaDocument
Section15.7.ModifyingaDocument
Section15.8.AddingContenttoaDocument
Section15.9.Example:ADynamicallyCreatedTableofContents
Section15.10.QueryingSelectedText
Section15.11.TheIE4DOM
Chapter16.CascadingStyleSheetsandDynamicHTML
Section16.1.OverviewofCSS
Section16.2.CSSforDHTML
Section16.3.ScriptingInlineStyles
Section16.4.ScriptingComputedStyles
Section16.5.ScriptingCSSClasses
Section16.6.ScriptingStylesheets
Chapter17.EventsandEventHandling
Section17.1.BasicEventHandling
Section17.2.AdvancedEventHandlingwithDOMLevel2
Section17.3.TheInternetExplorerEventModel
Section17.4.MouseEvents
Section17.5.KeyEvents
Section17.6.TheonloadEvent
Section17.7.SyntheticEvents
Chapter18.FormsandFormElements
Section18.1.TheFormObject
Section18.2.DefiningFormElements
Section18.3.ScriptingFormElements
Section18.4.FormVerificationExample
Chapter19.CookiesandClient-SidePersistence
Section19.1.AnOverviewofCookies
Section19.2.StoringCookies
Section19.3.ReadingCookies
Section19.4.CookieExample
Section19.5.CookieAlternatives
Section19.6.PersistentDataandSecurity
Chapter20.ScriptingHTTP
Section20.1.UsingXMLHttpRequest
Section20.2.XMLHttpRequestExamplesandUtilities
Section20.3.AjaxandDynamicScripting
Section20.4.ScriptingHTTPwith<script>Tags
Chapter21.JavaScriptandXML
Section21.1.ObtainingXMLDocuments
Section21.2.ManipulatingXMLwiththeDOMAPI
Section21.3.TransformingXMLwithXSLT
Section21.4.QueryingXMLwithXPath
Section21.5.SerializingXML
Section21.6.ExpandingHTMLTemplateswithXMLData
Section21.7.XMLandWebServices
Section21.8.E4X:ECMAScriptforXML
Chapter22.ScriptedClient-SideGraphics
Section22.1.ScriptingImages
Section22.2.GraphicswithCSS
Section22.3.SVG:ScalableVectorGraphics
Section22.4.VML:VectorMarkupLanguage
Section22.5.Graphicsina<canvas>
Section22.6.GraphicswithFlash
Section22.7.GraphicswithJava
Chapter23.ScriptingJavaAppletsandFlashMovies
Section23.1.ScriptingApplets
Section23.2.ScriptingtheJavaPlug-in
Section23.3.ScriptingwithJava
Section23.4.ScriptingFlash
Section23.5.ScriptingFlash8
PartIII:CoreJavaScriptReference
Chapter24.CoreJavaScriptReference
Section24.1.SampleEntry:howtoreadthesereferencepages
Section24.2.arguments[]:anarrayoffunctionarguments
Section24.3.Arguments:argumentsandotherpropertiesofafunction
Section24.4.Arguments.callee:thefunctionthatiscurrentlyrunning
Section24.5.Arguments.length:thenumberofargumentspassedtoafunction
Section24.6.Array:built-insupportforarrays
Section24.7.Array.concat():concatenatearrays
Section24.8.Array.join():concatenatearrayelementstoformastring
Section24.9.Array.length:thesizeofanarray
Section24.10.Array.pop():removeandreturnthelastelementofanarray
Section24.11.Array.push():appendelementstoanarray
Section24.12.Array.reverse():reversetheelementsofanarray
Section24.13.Array.shift():shiftarrayelementsdown
Section24.14.Array.slice():returnaportionofanarray
Section24.15.Array.sort():sorttheelementsofanarray
Section24.16.Array.splice():insert,remove,orreplacearrayelements
Section24.17.Array.toLocaleString():convertanarraytoalocalizedstring
Section24.18.Array.toString():convertanarraytoastring
Section24.19.Array.unshift():insertelementsatthebeginningofanarray
Section24.20.Boolean:supportforbooleanvalues
Section24.21.Boolean.toString():convertabooleanvaluetoastring
Section24.22.Boolean.valueOf():thebooleanvalueofaBooleanobject
Section24.23.Date:manipulatedatesandtimes
Section24.24.Date.getDate():returntheday-of-the-monthfieldofaDate
Section24.25.Date.getDay():returntheday-of-the-weekfieldofaDate
Section24.26.Date.getFullYear():returntheyearfieldofaDate
Section24.27.Date.getHours():returnthehoursfieldofaDate
Section24.28.Date.getMilliseconds():returnthemillisecondsfieldofaDate
Section24.29.Date.getMinutes():returntheminutesfieldofaDate
Section24.30.Date.getMonth():returnthemonthfieldofaDate
Section24.31.Date.getSeconds():returnthesecondsfieldofaDate
Section24.32.Date.getTime():returnaDateinmilliseconds
Section24.33.Date.getTimezoneOffset():determinetheoffsetfromGMT
Section24.34.Date.getUTCDate():returntheday-of-the-monthfieldofaDate
(universaltime)
Section24.35.Date.getUTCDay():returntheday-of-the-weekfieldofaDate
(universaltime)
Section24.36.Date.getUTCFullYear():returntheyearfieldofaDate
(universaltime)
Section24.37.Date.getUTCHours():returnthehoursfieldofaDate(universal
time)
Section24.38.Date.getUTCMilliseconds():returnthemillisecondsfieldofa
Date(universaltime)
Section24.39.Date.getUTCMinutes():returntheminutesfieldofaDate
(universaltime)
Section24.40.Date.getUTCMonth():returnthemonth-of-the-yearfieldofa
Date(universaltime)
Section24.41.Date.getUTCSeconds():returnthesecondsfieldofaDate
(universaltime)
Section24.42.Date.getYear():returntheyearfieldofaDate
Section24.43.Date.parse():parseadate/timestring
Section24.44.Date.setDate():settheday-of-the-monthfieldofaDate
Section24.45.Date.setFullYear():settheyearand,optionally,themonthand
datefieldsofaDate
Section24.46.Date.setHours():setthehours,minutes,seconds,and
millisecondsfieldsofaDate
Section24.47.Date.setMilliseconds():setthemillisecondsfieldofaDate
Section24.48.Date.setMinutes():settheminutes,seconds,andmilliseconds
fieldsofaDate
Section24.49.Date.setMonth():setthemonthanddayfieldsofaDate
Section24.50.Date.setSeconds():setthesecondsandmillisecondsfieldsofa
Date
Section24.51.Date.setTime():setaDateinmilliseconds
Section24.52.Date.setUTCDate():settheday-of-the-monthfieldofaDate
(universaltime)
Section24.53.Date.setUTCFullYear():settheyear,month,anddayfieldsofa
Date(universaltime)
Section24.54.Date.setUTCHours():setthehours,minutes,seconds,and
millisecondsfieldsofaDate(universaltime)
Section24.55.Date.setUTCMilliseconds():setthemillisecondsfieldofaDate
(universaltime)
Section24.56.Date.setUTCMinutes():settheminutes,seconds,and
millisecondsfieldsofaDate(universaltime)
Section24.57.Date.setUTCMonth():setthemonthanddayfieldsofaDate
(universaltime)
Section24.58.Date.setUTCSeconds():setthesecondsandmilliseconds
fieldsofaDate(universaltime)
Section24.59.Date.setYear():settheyearfieldofaDate
Section24.60.Date.toDateString():returnthedateportionofaDateasa
string
Section24.61.Date.toGMTString():convertaDatetoauniversaltimestring
Section24.62.Date.toLocaleDateString():returnthedateportionofaDateas
alocallyformattedstring
Section24.63.Date.toLocaleString():convertaDatetoalocallyformatted
string
Section24.64.Date.toLocaleTimeString():returnthetimeportionofaDateas
alocallyformattedstring
Section24.65.Date.toString():convertaDatetoastring
Section24.66.Date.toTimeString():returnthetimeportionofaDateasa
string
Section24.67.Date.toUTCString():convertaDatetoastring(universaltime)
Section24.68.Date.UTC():convertaDatespecificationtomilliseconds
Section24.69.Date.valueOf():convertaDatetomillisecondrepresentation
Section24.70.decodeURI():unescapecharactersinaURI
Section24.71.decodeURIComponent():unescapecharactersinaURI
component
Section24.72.encodeURI():escapecharactersinaURI
Section24.73.encodeURIComponent():escapecharactersinaURI
component
Section24.74.Error:agenericexception
Section24.75.Error.message:ahuman-readableerrormessage
Section24.76.Error.name:thetypeofanerror
Section24.77.Error.toString():convertanErrorobjecttoastring
Section24.78.escape():encodeastring
Section24.79.eval():executeJavaScriptcodefromastring
Section24.80.EvalError:thrownwheneval()isusedimproperly
Section24.81.Function:aJavaScriptfunction
Section24.82.Function.apply():invokeafunctionasamethodofanobject
Section24.83.Function.arguments[]:argumentspassedtoafunction
Section24.84.Function.call():invokeafunctionasamethodofanobject
Section24.85.Function.caller:thefunctionthatcalledthisone
Section24.86.Function.length:thenumberofdeclaredarguments
Section24.87.Function.prototype:theprototypeforaclassofobjects
Section24.88.Function.toString():convertafunctiontoastring
Section24.89.getClass():returntheJavaClassofaJavaObject
Section24.90.Global:theglobalobject
Section24.91.Infinity:anumericpropertythatrepresentsinfinity
Section24.92.isFinite():determinewhetheranumberisfinite
Section24.93.isNaN():checkfornot-a-number
Section24.94.java:theJavaPackageforthejava.*packagehierarchy
Section24.95.JavaArray:JavaScriptrepresentationofaJavaarray
Section24.96.JavaClass:JavaScriptrepresentationofaJavaclass
Section24.97.JavaObject:JavaScriptrepresentationofaJavaobject
Section24.98.JavaPackage:JavaScriptrepresentationofaJavapackage
Section24.99.JSObject:seeJSObjectinPartIV
Section24.100.Math:mathematicalfunctionsandconstants
Section24.101.Math.abs():computeanabsolutevalue
Section24.102.Math.acos():computeanarccosine
Section24.103.Math.asin():computeanarcsine
Section24.104.Math.atan():computeanarctangent
Section24.105.Math.atan2():computetheanglefromtheXaxistoapoint
Section24.106.Math.ceil():roundanumberup
Section24.107.Math.cos():computeacosine
Section24.108.Math.E:themathematicalconstante
Section24.109.Math.exp():computeex
Section24.110.Math.floor():roundanumberdown
Section24.111.Math.LN10:themathematicalconstantloge2
Section24.112.Math.LN2:themathematicalconstantloge10
Section24.113.Math.log():computeanaturallogarithm
Section24.114.Math.LOG10E:themathematicalconstantlog2e
Section24.115.Math.LOG2E:themathematicalconstantlog10e
Section24.116.Math.max():returnthelargestargument
Section24.117.Math.min():returnthesmallestargument
Section24.118.Math.PI:themathematicalconstantπ
Section24.119.Math.pow():computexy
Section24.120.Math.random():returnapseudorandomnumber
Section24.121.Math.round():roundtothenearestinteger
Section24.122.Math.sin():computeasine
Section24.123.Math.sqrt():computeasquareroot
Section24.124.Math.SQRT1_2:themathematicalconstant1/
Section24.125.Math.SQRT2:themathematicalconstant
Section24.126.Math.tan():computeatangent
Section24.127.NaN:thenot-a-numberproperty
Section24.128.Number:supportfornumbers
Section24.129.Number.MAX_VALUE:themaximumnumericvalue
Section24.130.Number.MIN_VALUE:theminimumnumericvalue
Section24.131.Number.NaN:thespecialnot-a-numbervalue
Section24.132.Number.NEGATIVE_INFINITY:negativeinfinity
Section24.133.Number.POSITIVE_INFINITY:infinity
Section24.134.Number.toExponential():formatanumberusingexponential
notation
Section24.135.Number.toFixed():formatanumberusingfixed-pointnotation
Section24.136.Number.toLocaleString():convertanumbertoalocally
formattedstring
Section24.137.Number.toPrecision():formatthesignificantdigitsofanumber
Section24.138.Number.toString():convertanumbertoastring
Section24.139.Number.valueOf():returntheprimitivenumbervalue
Section24.140.Object:asuperclassthatcontainsfeaturesofallJavaScript
objects
Section24.141.Object.constructor:anobject'sconstructorfunction
Section24.142.Object.hasOwnProperty():checkwhetherapropertyis
Section24.144.Object.propertyIsEnumerable():willpropertybeseenbya
for/inloop?
Section24.145.Object.toLocaleString():returnanobject'slocalizedstring
representation
Section24.146.Object.toString():defineanobject'sstringrepresentation
Section24.147.Object.valueOf():theprimitivevalueofthespecifiedobject
Section24.148.Packages:therootJavaPackage
Section24.149.parseFloat():convertastringtoanumber
Section24.150.parseInt():convertastringtoaninteger
Section24.151.RangeError:thrownwhenanumberisoutofitslegalrange
Section24.152.ReferenceError:thrownwhenreadingavariablethatdoesnot
exist
Section24.153.RegExp:regularexpressionsforpatternmatching
Section24.154.RegExp.exec():general-purposepatternmatching
Section24.155.RegExp.global:whetheraregularexpressionmatchesglobally
Section24.156.RegExp.ignoreCase:whetheraregularexpressioniscaseinsensitive
Section24.157.RegExp.lastIndex:thestartingpositionofthenextmatch
Section24.158.RegExp.source:thetextoftheregularexpression
Section24.159.RegExp.test():testwhetherastringmatchesapattern
Section24.160.RegExp.toString():convertaregularexpressiontoastring
Section24.161.String:supportforstrings
Section24.162.String.charAt():getthenthcharacterfromastring
Section24.163.String.charCodeAt():getthenthcharactercodefromastring
Section24.164.String.concat():concatenatestrings
Section24.165.String.fromCharCode():createastringfromcharacter
encodings
Section24.166.String.indexOf():searchastring
Section24.167.String.lastIndexOf():searchastringbackward
Section24.168.String.length:thelengthofastring
Section24.169.String.localeCompare():compareonestringtoanother,using
locale-specificordering
Section24.170.String.match():findoneormoreregular-expressionmatches
Section24.171.String.replace():replacesubstring(s)matchingaregular
expression
Section24.172.String.search():searchforaregularexpression
Section24.173.String.slice():extractasubstring
Section24.174.String.split():breakastringintoanarrayofstrings
inherited
Section24.143.Object.isPrototypeOf():isoneobjecttheprototypeofanother?
Section24.175.String.substr():extractasubstring
Section24.176.String.substring():returnasubstringofastring
Section24.177.String.toLocaleLowerCase():convertastringtolowercase
Section24.178.String.toLocaleUpperCase():convertastringtouppercase
Section24.179.String.toLowerCase():convertastringtolowercase
Section24.180.String.toString():returnthestring
Section24.181.String.toUpperCase():convertastringtouppercase
Section24.182.String.valueOf():returnthestring
Section24.183.SyntaxError:throwntosignalasyntaxerror
Section24.184.TypeError:thrownwhenavalueisofthewrongtype
Section24.185.undefined:theundefinedvalue
Section24.186.unescape():decodeanescapedstring
Section24.187.URIError:thrownbyURIencodinganddecodingmethods
PartIV:Client-SideJavaScriptReference
Chapter25.Client-SideJavaScriptReference
Section25.1.Anchor:thetargetofahypertextlink
Section25.2.Anchor.focus():scrolltomaketheanchorlocationvisible
Section25.3.Applet:anappletembeddedinawebpage
Section25.4.Attr:anattributeofadocumentelement
Section25.5.Button:seeInput
Section25.6.Canvas:anHTMLelementforscripteddrawing
Section25.7.Canvas.getContext():returnacontextfordrawingonthecanvas
Section25.8.CanvasGradient:acolorgradientforuseinacanvas
Section25.9.CanvasGradient.addColorStop():addachangeofcoloratsome
pointinthegradient
Section25.10.CanvasPattern:animage-basedpatternforuseinaCanvas
Section25.11.CanvasRenderingContext2D:theobjectusedfordrawingona
canvas
Section25.12.CanvasRenderingContext2D.arc():addanarctothecurrent
subpathofacanvas,usingacenterpointandradius
Section25.13.CanvasRenderingContext2D.arcTo():addanarcofacircleto
thecurrentsubpath,usingtangentpointsandaradius
Section25.14.CanvasRenderingContext2D.beginPath():startanewcollection
ofsubpathsinacanvas
Section25.15.CanvasRenderingContext2D.bezierCurveTo():addacubic
Béziercurvetothecurrentsubpath
Section25.16.CanvasRenderingContext2D.clearRect():erasearectangular
areaofacanvas
Section25.17.CanvasRenderingContext2D.clip():settheclippingpathofa
canvas
Section25.18.CanvasRenderingContext2D.closePath():closesanopen
subpath
Section25.19.CanvasRenderingContext2D.createLinearGradient():createa
linearcolorgradient
Section25.20.CanvasRenderingContext2D.createPattern():createapattern
oftiledimages
Section25.21.CanvasRenderingContext2D.createRadialGradient():createa
radialcolorgradient
Section25.22.CanvasRenderingContext2D.drawImage():drawanimage
Section25.23.CanvasRenderingContext2D.fill():fillthepath
Section25.24.CanvasRenderingContext2D.fillRect():fillarectangle
Section25.25.CanvasRenderingContext2D.globalCompositeOperation:
specifieshowcolorsarecombinedonthecanvas
Section25.26.CanvasRenderingContext2D.lineCap:specifieshowtheendsof
linesarerendered
Section25.27.CanvasRenderingContext2D.lineJoin:specifieshowvertices
arerendered
Section25.28.CanvasRenderingContext2D.lineTo():addastraightlinetothe
currentsubpath
Section25.29.CanvasRenderingContext2D.miterLimit:maximum-miter-lengthto-line-widthratio
Section25.30.CanvasRenderingContext2D.moveTo():setsthecurrent
positionandbeginsanewsubpath
Section25.31.CanvasRenderingContext2D.quadraticCurveTo():adda
quadraticBeziercurvetothecurrentsubpath
Section25.32.CanvasRenderingContext2D.rect():addarectanglesubpathto
thepath
Section25.33.CanvasRenderingContext2D.restore():resetdrawingstateto
savedvalues
Section25.34.CanvasRenderingContext2D.rotate():rotatethecoordinate
systemofthecanvas
Section25.35.CanvasRenderingContext2D.save():saveacopyofthecurrent
graphicsstate
Section25.36.CanvasRenderingContext2D.scale():scaletheusercoordinate
systemofthecanvas
Section25.37.CanvasRenderingContext2D.stroke():drawthecurrentpath
Section25.38.CanvasRenderingContext2D.strokeRect():drawarectangle
Section25.39.CanvasRenderingContext2D.translate():translatetheuser
coordinatesystemofthecanvas
Section25.41.CharacterData:commonfunctionalityforTextandComment
nodes
Section25.42.CharacterData.appendData():appendastringtoaTextor
Commentnode
Section25.43.CharacterData.deleteData():deletecharactersfromaTextor
Commentnode
Section25.44.CharacterData.insertData():insertastringintoaTextor
Commentnode
Section25.45.CharacterData.replaceData():replacecharactersofaTextor
Commentnodewithastring
Section25.46.CharacterData.substringData():extractasubstringfromaText
orCommentnode
Section25.47.Checkbox:seeInput
Section25.48.Comment:anHTMLorXMLcomment
Section25.49.CSS2Properties:asetofCSSattributesandtheirvalues
Section25.50.CSSRule:aruleinaCSSstylesheet
Section25.51.CSSStyleSheet:aCSSstylesheet
Section25.52.CSSStyleSheet.addRule():IE-specificmethodtoinsertarule
intoastylesheet
Section25.53.CSSStyleSheet.deleteRule():deletearulefromastylesheet
Section25.54.CSSStyleSheet.insertRule():insertaruleintoastylesheet
Section25.55.CSSStyleSheet.removeRule():IE-specificmethodtoremovea
rulefromastylesheet
Section25.56.Document:anHTMLorXMLdocument
Section25.57.Document.addEventListener():seeElement.addEventListener(
)
Section25.58.Document.attachEvent():seeElement.attachEvent()
Section25.59.Document.createAttribute():createanewAttrnode
Section25.60.Document.createAttributeNS():createanAttrwithanameand
namespace
Section25.61.Document.createCDATASection():createanewCDATASection
node
Section25.62.Document.createComment():createanewCommentnode
Section25.63.Document.createDocumentFragment():createanew,empty
DocumentFragmentnode
Section25.64.Document.createElement():createanewElementnode
Section25.65.Document.createElementNS():createanewElementnode
usinganamespace
Section25.66.Document.createEvent():createanEventobject
Section25.40.CDATASection:aCDATAnodeinanXMLdocument
Section25.67.Document.createExpression():createanXPathexpressionfor
laterevaluation
Section25.68.Document.createProcessingInstruction():createa
ProcessingInstructionnode
Section25.69.Document.createRange():createaRangeobject
Section25.70.Document.createTextNode():createanewTextnode
Section25.71.Document.detachEvent():seeElement.detachEvent()
Section25.72.Document.dispatchEvent():seeElement.dispatchEvent()
Section25.73.Document.evaluate():evaluateanXPathexpression
Section25.74.Document.getElementById():findanelementwiththespecified
uniqueID
Section25.75.Document.getElementsByTagName():returnallElementnodes
withthespecifiedname
Section25.76.Document.getElementsByTagNameNS():returnallElement
nodeswithaspecifiednameandnamespace
Section25.77.Document.importNode():copyanodefromanotherdocument
foruseinthisdocument
Section25.78.Document.loadXML():populatethisDocumentbyparsinga
stringofXMLmarkup
Section25.79.Document.removeEventListener():see
Element.removeEventListener()
Section25.80.DocumentFragment:adjacentnodesandtheirsubtrees
Section25.81.DocumentType:theDTDofanXMLdocument
Section25.82.DOMException:signalexceptionsorerrorsforcoreDOM
objects
Section25.83.DOMImplementation:methodsindependentofanyparticular
document
Section25.84.DOMImplementation.createDocument():createanew
Documentandthespecifiedrootelement
Section25.85.DOMImplementation.createDocumentType():createa
DocumentTypenode
Section25.86.DOMImplementation.hasFeature():determinewhetherthe
implementationsupportsafeature
Section25.87.DOMParser:parsesXMLmarkuptocreateaDocument
Section25.88.DOMParser.parseFromString():parseXMLmarkup
Section25.89.Element:anHTMLorXMLelement
Section25.90.Element.addEventListener():registeraneventhandler
Section25.91.Element.attachEvent():registeraneventhandler
Section25.92.Element.detachEvent():deleteaneventlistener
Section25.93.Element.dispatchEvent():dispatchasyntheticeventtothis
Section25.95.Element.getAttributeNode():returntheAttrnodeforthenamed
attribute
Section25.96.Element.getAttributeNodeNS():returntheAttrnodeforan
attributewithanamespace
Section25.97.Element.getAttributeNS():getthevalueofanattributethat
usesnamespaces
Section25.98.Element.getElementsByTagName():finddescendantelements
withaspecifiedtagname
Section25.99.Element.getElementsByTagNameNS():returndescendant
elementswiththespecifiednameandnamespace
Section25.100.Element.hasAttribute():determinewhetherthiselementhasa
specifiedattribute
Section25.101.Element.hasAttributeNS():determinewhetherthiselement
hasaspecifiedattribute
Section25.102.Element.removeAttribute():deleteanamedattributeofan
element
Section25.103.Element.removeAttributeNode():removeanAttrnodefroman
element
Section25.104.Element.removeAttributeNS():deleteanattributespecifiedby
nameandnamespace
Section25.105.Element.removeEventListener():deleteaneventlistener
Section25.106.Element.setAttribute():createorchangeanattributeofan
element
Section25.107.Element.setAttributeNode():addanewAttrnodetoan
Element
Section25.108.Element.setAttributeNodeNS():addanamespaceAttrnodeto
anElement
Section25.109.Element.setAttributeNS():createorchangeanattributewitha
namespace
Section25.110.Event:informationaboutanevent
Section25.111.Event.initEvent():initializethepropertiesofanewevent
Section25.112.Event.preventDefault():canceldefaultactionofanevent
Section25.113.Event.stopPropagation():donotdispatchaneventanyfurther
Section25.114.ExternalInterface:abidirectionalinterfacetoFlash
Section25.115.ExternalInterface.addCallback():exposeanActionScript
methodforexecutionfromJavaScript
Section25.116.ExternalInterface.call():callaJavaScriptfunctionfrom
node
Section25.94.Element.getAttribute():returnthestringvalueofanamed
attribute
ActionScript
Section25.117.FileUpload:seeInput
Section25.118.FlashPlayer:plug-inforFlashmovies
Section25.119.FlashPlayer.GetVariable():returnavaluedefinedinaFlash
movie
Section25.120.FlashPlayer.GotoFrame():skiptothespecifiedframeofa
movie
Section25.121.FlashPlayer.IsPlaying():checkwhetheramovieisplaying
Section25.122.FlashPlayer.LoadMovie():loadanauxiliarymovie
Section25.123.FlashPlayer.Pan():movetheviewportofthemovie
Section25.124.FlashPlayer.PercentLoaded():determinehowmuchofthe
moviehasloaded
Section25.125.FlashPlayer.Play():playamovie
Section25.126.FlashPlayer.Rewind():rewindthemovietoitsfirstframe
Section25.127.FlashPlayer.SetVariable():setavariabledefinedbyaFlash
movie
Section25.128.FlashPlayer.SetZoomRect():settheviewportofamovie
Section25.129.FlashPlayer.StopPlay():stopthemovie
Section25.130.FlashPlayer.TotalFrames():returnthelengthofthemovie,in
frames
Section25.131.FlashPlayer.Zoom():zoominorout
Section25.132.Form:a<form>inanHTMLdocument
Section25.133.Form.elements[]:theinputelementsofaform
Section25.134.Form.onreset:eventhandlerinvokedwhenaformisreset
Section25.135.Form.onsubmit:eventhandlerinvokedwhenaformis
submitted
Section25.136.Form.reset():resettheelementsofaformtotheirdefault
values
Section25.137.Form.submit():submitformdatatoawebserver
Section25.138.Frame:a<frame>inanHTMLdocument
Section25.139.Hidden:seeInput
Section25.140.History:theURLhistoryofthebrowser
Section25.141.History.back():returntothepreviousURL
Section25.142.History.forward():visitthenextURL
Section25.143.History.go():revisitaURL
Section25.144.HTMLCollection:arrayofHTMLelementsaccessibleby
positionorname
Section25.145.HTMLCollection.item():getanelementbyposition
Section25.146.HTMLCollection.namedItem():getanelementbyname
Section25.147.HTMLDocument:therootofanHTMLdocumenttree
Section25.148.HTMLDocument.all[]:allHTMLelementsinadocument
Section25.149.HTMLDocument.close():closeanopendocumentanddisplay
it
Section25.150.HTMLDocument.cookie:thecookie(s)ofthedocument
Section25.151.HTMLDocument.domain:thesecuritydomainofadocument
Section25.152.HTMLDocument.getElementsByName():findelementswith
thespecifiednameattribute
Section25.153.HTMLDocument.open():beginanewdocument,erasingthe
currentone
Section25.154.HTMLDocument.write():appendHTMLtexttoanopen
document
Section25.155.HTMLDocument.writeln():appendHTMLtextandanewlineto
anopendocument
Section25.156.HTMLElement:anelementinanHTMLdocument
Section25.157.HTMLElement.onclick:eventhandlerinvokedwhentheuser
clicksonanelement
Section25.158.HTMLElement.ondblclick:eventhandlerinvokedwhenthe
userdouble-clicksonanelement
Section25.159.HTMLElement.onkeydown:eventhandlerinvokedwhenthe
userpressesakey
Section25.160.HTMLElement.onkeypress:eventhandlerinvokedwhenthe
userpressesakey
Section25.161.HTMLElement.onkeyup:eventhandlerinvokedwhentheuser
releasesakey
Section25.162.HTMLElement.onmousedown:eventhandlerinvokedwhen
theuserpressesamousebutton
Section25.163.HTMLElement.onmousemove:eventhandlerinvokedwhen
themousemoveswithinanelement
Section25.164.HTMLElement.onmouseout:eventhandlerinvokedwhen
mousemovesoutofanelement
Section25.165.HTMLElement.onmouseover:eventhandlerinvokedwhenthe
mousemovesoveranelement
Section25.166.HTMLElement.onmouseup:eventhandlerinvokedwhenthe
userreleasesamousebutton
Section25.167.HTMLElement.scrollIntoView():makeanelementvisible
Section25.168.IFrame:an<iframe>inanHTMLdocument
Section25.169.Image:animageinanHTMLdocument
Section25.170.Image.onabort:eventhandlerinvokedwhentheuseraborts
imageloading
Section25.171.Image.onerror:eventhandlerinvokedwhenanerroroccurs
duringimageloading
Section25.172.Image.onload:eventhandlerinvokedwhenanimagefinishes
loading
Section25.173.Input:aninputelementinanHTMLform
Section25.174.Input.blur():removekeyboardfocusfromaformelement
Section25.175.Input.click():simulateamouseclickonaformelement
Section25.176.Input.focus():givekeyboardfocustoaformelement
Section25.177.Input.onblur:thehandlerinvokedwhenaformelementloses
focus
Section25.178.Input.onchange:eventhandlerinvokedwhenaformelement's
valuechanges
Section25.179.Input.onclick:eventhandlerinvokedwhenaformelementis
clicked
Section25.180.Input.onfocus:eventhandlerinvokedwhenaformelement
gainsfocus
Section25.181.Input.select():selectthetextinaformelement
Section25.182.JavaArray,JavaClass,JavaObject,JavaPackage:seePartIII
Section25.183.JSObject:JavarepresentationofaJavaScriptobject
Section25.184.JSObject.call():invokeamethodofaJavaScriptobject
Section25.185.JSObject.eval():evaluateastringofJavaScriptcode
Section25.186.JSObject.getMember():readapropertyofaJavaScriptobject
Section25.187.JSObject.getSlot():readanarrayelementofaJavaScript
object
Section25.188.JSObject.getWindow():returninitialJSObjectforbrowser
window
Section25.189.JSObject.removeMember():deleteapropertyofaJavaScript
object
Section25.190.JSObject.setMember():setapropertyofaJavaScriptobject
Section25.191.JSObject.setSlot():setanarrayelementofaJavaScript
object
Section25.192.JSObject.toString():returnthestringvalueofaJavaScript
object
Section25.193.KeyEvent:detailsaboutakeyboardevent
Section25.194.Layer:anobsoleteNetscapeAPI
Section25.195.Link:ahyperlinkoranchorinanHTMLdocument
Section25.196.Link.blur():takekeyboardfocusawayfromahyperlink
Section25.197.Link.focus():makealinkvisibleandgiveitkeyboardfocus
Section25.198.Link.onclick:eventhandlerinvokedwhenaLinkisclicked
Section25.199.Link.onmouseout:eventhandlerinvokedwhenthemouse
leavesalink
Section25.200.Link.onmouseover:eventhandlerinvokedwhenthemouse
goesoveralink
Section25.203.Location.replace():replaceonedisplayeddocumentwith
another
Section25.204.MimeType:representsaMIMEdatatype
Section25.205.MouseEvent:detailsaboutamouseevent
Section25.206.MouseEvent.initMouseEvent():initializethepropertiesofa
MouseEventobject
Section25.207.Navigator:informationaboutthebrowserinuse
Section25.208.Navigator.javaEnabled():testwhetherJavaisavailable
Section25.209.Node:anodeinadocumenttree
Section25.210.Node.appendChild():insertanodeasthelastchildofthis
node
Section25.211.Node.cloneNode():duplicateanodeand,optionally,allofits
descendants
Section25.212.Node.hasAttributes():determinewhetheranodehas
attributes
Section25.213.Node.hasChildNodes():determinewhetheranodehas
children
Section25.214.Node.insertBefore():insertanodeintothedocumenttree
beforethespecifiednode
Section25.215.Node.isSupported():determineifanodesupportsafeature
Section25.216.Node.normalize():mergeadjacentTextnodesandremove
emptyones
Section25.217.Node.removeChild():remove(andreturn)thespecifiedchild
ofthisnode
Section25.218.Node.replaceChild():replaceachildnodewithanewnode
Section25.219.Node.selectNodes():selectnodeswithanXPathquery
Section25.220.Node.transformNode():transformanodetoastringusing
XSLT
Section25.221.Node.transformNodeToObject():transformanodetoa
documentusingXSLT
Section25.222.NodeList:aread-onlyarrayofnodes
Section25.223.NodeList.item():getanelementofaNodeList
Section25.201.Location:representsandcontrolsbrowserlocation
Section25.202.Location.reload():reloadthecurrentdocument
Section25.224.Option:anoptioninaSelectelement
Section25.225.Packages:seePackagesinPartIII
Section25.226.Password:seeInput
Section25.227.Plugin:describesaninstalledplug-in
Section25.228.ProcessingInstruction:aprocessinginstructioninanXML
document
Section25.229.Radio:seeInput
Section25.230.Range:representsacontiguousrangeofadocument
Section25.231.Range.cloneContents():copyrangecontentsintoa
DocumentFragment
Section25.232.Range.cloneRange():makeacopyofthisrange
Section25.233.Range.collapse():makeoneboundarypointequaltotheother
Section25.234.Range.compareBoundaryPoints():comparepositionsoftwo
ranges
Section25.235.Range.deleteContents():deletearegionofthedocument
Section25.236.Range.detach():freeaRangeobject
Section25.237.Range.extractContents():deletedocumentcontentandreturn
itinaDocumentFragment
Section25.238.Range.insertNode():insertanodeatthestartofarange
Section25.239.Range.selectNode():setrangeboundariestoanode
Section25.240.Range.selectNodeContents():setrangeboundariestothe
childrenofanode
Section25.241.Range.setEnd():settheendpointofarange
Section25.242.Range.setEndAfter():endarangeafteraspecifiednode
Section25.243.Range.setEndBefore():endarangebeforethespecifiednode
Section25.244.Range.setStart():setthestartpointofarange
Section25.245.Range.setStartAfter():startarangeafterthespecifiednode
Section25.246.Range.setStartBefore():startarangebeforethespecified
node
Section25.247.Range.surroundContents():surroundrangecontentswiththe
specifiednode
Section25.248.Range.toString():getrangecontentsasaplain-textstring
Section25.249.RangeException:signalsarange-specificexception
Section25.250.Reset:seeInput
Section25.251.Screen:providesinformationaboutthedisplay
Section25.252.Synopsis
Section25.253.Select:agraphicalselectionlist
Section25.254.Select.add():insertan<option>element
Section25.255.Select.blur():takekeyboardfocusawayfromthiselement
Section25.256.Select.focus():givekeyboardfocustothiselement
Section25.257.Select.onchange:eventhandlerinvokedwhentheselection
changes
Section25.258.Select.options[]:thechoicesinaSelectobject
Section25.259.Select.remove():removean<option>
Section25.260.Style:seeCSS2Properties
Section25.261.Submit:seeInput
Section25.262.Table:a<table>inanHTMLdocument
Section25.263.Table.createCaption():getorcreatea<caption>
Section25.264.Table.createTFoot():getorcreatea<tfoot>
Section25.265.Table.createTHead():getorcreatea<thead>
Section25.266.Table.deleteCaption():deletethe<caption>ofatable
Section25.267.Table.deleteRow():deletearowofatable
Section25.268.Table.deleteTFoot():deletethe<tfoot>ofatable
Section25.269.Table.deleteTHead():deletethe<thead>ofatable
Section25.270.Table.insertRow():addanew,emptyrowtothetable
Section25.271.TableCell:cellinanHTMLtable
Section25.272.TableRow:a<tr>elementinanHTMLtable
Section25.273.TableRow.deleteCell():deleteacellinatablerow
Section25.274.TableRow.insertCell():insertanew,empty<td>elementintoa
tablerow
Section25.275.TableSection:aheader,footer,orbodysectionofatable
Section25.276.TableSection.deleteRow():deletearowwithinatablesection
Section25.277.TableSection.insertRow():insertanew,emptyrowintothis
tablesection
Section25.278.Text:arunoftextinanHTMLorXMLdocument
Section25.279.Text.splitText():splitaTextnodeintwo
Section25.280.Textarea:amultilinetextinputarea
Section25.281.Textarea.blur():takekeyboardfocusawayfromthiselement
Section25.282.Textarea.focus():givekeyboardfocustothiselement
Section25.283.Textarea.onchange:eventhandlerinvokedwheninputvalue
changes
Section25.284.Textarea.select():selectthetextinthiselement
Section25.285.TextField:seeInput
Section25.286.UIEvent:detailsaboutuser-interfaceevents
Section25.287.UIEvent.initUIEvent():initializethepropertiesofaUIEvent
object
Section25.288.Window:awebbrowserwindoworframe
Section25.289.Window.addEventListener():seeElement.addEventListener()
Section25.290.Window.alert():displayamessageinadialogbox
Section25.291.Window.attachEvent():seeElement.attachEvent()
Section25.292.Window.blur():removekeyboardfocusfromatop-level
window
Section25.293.Window.clearInterval():stopperiodicallyexecutingcode
Section25.294.Window.clearTimeout():canceldeferredexecution
Section25.295.Window.close():closeabrowserwindow
Section25.296.Window.confirm():askayes-or-noquestion
Section25.297.Window.defaultStatus:thedefaultstatuslinetext
Section25.298.Window.detachEvent():seeElement.detachEvent()
Section25.299.Window.focus():givekeyboardfocustoawindow
Section25.300.Window.getComputedStyle():retrievetheCSSstylesusedto
renderanelement
Section25.301.Window.moveBy():moveawindowtoarelativeposition
Section25.302.Window.moveTo():moveawindowtoanabsoluteposition
Section25.303.Window.onblur:eventhandlerinvokedwhenthewindowloses
keyboardfocus
Section25.304.Window.onerror:errorhandlerinvokedwhenaJavaScript
erroroccurs
Section25.305.Window.onfocus:eventhandlerinvokedwhenawindowis
givenfocus
Section25.306.Window.onload:eventhandlerinvokedwhenadocument
finishesloading
Section25.307.Window.onresize:eventhandlerinvokedwhenawindowis
resized
Section25.308.Window.onunload:thehandlerinvokedwhenthebrowser
leavesapage
Section25.309.Window.open():openanewbrowserwindoworlocatea
namedwindow
Section25.310.Window.print():printthedocument
Section25.311.Window.prompt():getuserinputwithadialogbox