JavaScript Bible 5th Edition Danny Goodman Appendix A

JavaScript and Browser Objects Quick Reference 18 February 2004

©2004 Danny Goodman (www.dannyg.com). All Rights Reserved. 3

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. IE4+, NN6+ style Object Properties JSB5 IE4,N6 Operators 32 style 26

Comparison Text & Fonts Borders & Edges Inline Display & Layout == Equals color IE4, N6 borderIE4, N6 clear IE4, N6 N4, IE4 === Strictly equals fontIE4, N6 borderBottomIE4, N6 clip IE4, N6 != Does not equal fontFamily IE4, N6 borderLeftIE4, N6 clipBottom W5 N4, IE4 !== Strictly does not equal JavaScript and fontSize IE4, N6 borderRightIE4, N6 clipLeft W5 > Is greater than fontSizeAdjust M5, N6 borderTopIE4, N6 clipRight W5 >= Is greater than or equal to fontStretch M5, N6 borderBottomColor IE4, N6 clipTop W5 < Is less than Browser Objects fontStyle IE4, N6 borderLeftColorIE4, N6 content M5, N6 <= Is less than or equal to fontVariant IE4, N6 borderRightColorIE4, N6 counterIncrement M5, N6 fontWeight IE4, N6 borderTopColorIE4, N6 counterReset M5, N6 Arithmetic letterSpacing IE4, N6 borderBottomStyle IE4, N6 cssFloat M5, N6 Quick Reference IE5 IE4, N6 IE4, N6 + Plus (and string concat.) lineBreak borderLeftStyle cursor - Minus lineHeight IE4, N6 borderRightStyle IE4, N6 direction IE5, N6 * Multiply quotes M5, N6 borderTopStyle IE4, N6 display IE4, N6 / Divide rubyAlign IE5 borderBottomWidth IE4, N6 filterW4 % Modulo rubyOverhangIE5 borderLeftWidth IE4, N6 layoutGrid W5 ++ Increment rubyPosition IE5 borderRightWidth IE4, N6 layoutGridChar W5 -- Decrement textAlign IE4, N6 borderTopWidth IE4, N6 layoutGridLine W5 -val Negation Appendix A textAlignLast IE5.5 borderColorIE4, N6 layoutGridMode W5 textAutospace W5 borderStyle IE4, N6 layoutGridType W5 Assignment textDecoration IE4, N6 borderWidth IE4, N6 markerOffsetM5, N6 = Equals textDecorationBlink IE-Only marginIE4, N6 marks M5, N6 += Add by value textDecorationLineThrough IE-Only marginBottom IE4, N6 maxHeight M5, N6 -= Subtract by value JavaScript Bible, 5th Edition textDecorationNone IE-Only marginLeft IE4, N6 maxWidth M5, N6 *= Multiply by value textDecorationOverline IE-Only marginRight IE4, N6 minHeight M5, N6, W6 /= Divide by value by Danny Goodman textDecorationUnderline IE-Only marginTopIE4, N6 minWidth M5, N6 %= Modulo by value textIndent IE4, N6 outline M5, N6 MozOpacity N6 <<= Left shift by value textJustify IE5 outlineColor M5, N6 overflow IE4, N6 >>= Right shift by value textJustifyTrim IE5 outlineStyle M5, N6 overflowX W5 >>>= Zero fill by value textKashidaSpace IE5.5 outlineWidth M5, N6 overflowY W5 &= Bitwise AND by value textOverflow W6 padding IE4, N6 styleFloat IE-Only |= Bitwise OR by value textShadow M5, N6 paddingBottom IE4, N6 verticalAlign IE4, N6 ^= Bitwise XOR by value textTransform IE4, N6 paddingLeft IE4, N6 visibility IE4, N6 textUnderlinePosition IE5.5 paddingRight IE4, N6 widthIE4, N6 Boolean unicodeBidi IE5, N6 paddingTop IE4, N6 zoom W5.5 && AND whiteSpace IE4, N6 || OR W5 wordBreak Tables Printing ! NOT M4, N6, W6 M5, N6 wordSpacing borderCollapse orphansM5, N6 W5.5 M5, N6 wordWrap borderSpacing widows M5, N6 Bitwise How to Use This Quick Reference W5.5 M5, N6 writingMode captionSide pageM5, N6 & Bitwise AND This guide contains quick reference info for the core JavaScript M5, N6 Positioning emptyCells pageBreakAfter IE4, N6 | Bitwise OR language, the original document object model (2 pp), the IE4+DHTML IE5, N6 IE5, N6 bottom tableLayout pageBreakBefore IE4, N6 ^ Bitwise XOR IE4, N6 object model (4 pp), and the W3C DOM object model(4 pp) as height pageBreakInside M5, N6 ~ Bitwise NOT implemented in IE5+, NN6, Mozilla, and browsers. All- leftIE4, N6 Lists N6 IE4, N6 size << Left shift uppercase object names refer to HTML elements (IE4+ and W3C pixelBottom IE/W-Only listStyle >> Right shift IE4, N6 DOMs). The three columns in each box list the object’s pixelHeight IE-Only listStyleImage >>> Zero fill right shift pixelLeft IE-Only listStylePosition IE4, N6 Miscellaneous properties,methods, and event handlers in that order. Read the W5 pixelRight IE/W-Only listStyleType IE4, N6 accelerator Miscellaneous compatibility guides for each section. IE-Only behavior W5 pixelTop IE4, N6 , Series delimiter pixelWidth IE-Only Background cssText N4, IE4 IE4, N6 W5 delete Property destroyer Numbers in the upper right corners of object squares are chapter posBottom IE/W-Only background imeMode N6, W5.5 in Item in object numbers in which the object is covered in detail. posHeight IE-Only backgroundAttachment IE4, N6 N6,W5 instanceof Instance of posLeft IE-Only backgroundColor IE4, N6 Scrollbars IE4, N6 new Object creator Basic browser and operating system notation codes are as follows: posRight IE/W-Only backgroundImage scrollbar3dLightColor W5.5 this Object self-reference posTopIE-Only gackgroundPosition IE4, N6 scrollbarArrowColor W5.5 N3, IE3 N — Navigator (including Mozilla when N6 or higher) typeof Value type posWidth IE-Only backgroundPositionX IE-Only scrollbarBaseColor W5.5 N3, IE3 IE — MS void Return no value position IE4, N6 backgroundPositionY IE-Only scrollbarDarkShadowColor W5.5 W — Windows MSIE M — MSIE IE4, N6 rightIE5, N6 backgroundRepeat scrollbarFaceColor W5.5 topIE4, N6 scrollbarHighlightColor W5.5 See the accompanying file for printing and collating instructions widthIE4, N6 scrollbarShadowColor W5.5 in booklet or broadside configurations. zIndex IE4, N6 scrollbarTrackColor W5.5 5

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. Page 2 of 2 — Original DOM (NN2+, IE3+) Quick Reference JSB5 form 21 select 24 action handleEvent( evt)N4 onresetN3, IE4 length blur()N3, IE4 onblur elements[] reset()N3, IE4 onsubmit name focus()N3, IE4 onchange encoding submit() options[i] handleEvent( evt)N4 onfocus length options[i].defaultSelected method options[i].index name options[i].selected target options[i].text options[i].value selectedIndex Original DOM typeN3, IE4 button, reset, submit 22 Compatibility Guide form click() onclick Baseline browsers for this section are N3 N4, IE4 name handleEvent( evt) onmousedown navigator 38 NN2, WinIE3/J1, and MacIE3.01. An item with typeN3, IE4 onmouseup N4, IE4 N3, M4 no notation is compatible back to that level, and is value appCodeName javaEnabled() found in all new scriptable browsers since then. appMinorVersion IE4 preference(name[, val ])N4,(S) N3, IE4 Notations indicate the browser and version appName taintEnabled() in which the property, method, or event handler checkbox 22 appVersion was introduced. browserLanguage IE4 N6, IE4 checked click() onclick cookieEnabled IE4 Except for the window and navigator objects defaultChecked handleEvent( evt)N3 onmousedown N4, IE4 cpuClass N4 (whose listings cover all browsers and form onmouseup N4, IE4 language N3, M4 versions), new features listed in this section name mimeTypes[] IE4 cover only through NN4 (and IE4 when they typeN3, IE4 onLine N6 matched a new NN4 feature). Notations are value oscpu as follows: platformN4, IE4 N3, M4 N3 — New in NN3 plugins[] N4 — New in NN4 productN6 radio 22 N6 J2 — New in IE3, JScript.dll ver.2 productSub IE4 — New in IE4, all OSes securityPolicy N4 checked click() onclick (S) — Requires signed scripts (NN) systemLanguage IE4 defaultChecked handleEvent( evt)N3 onmousedown N4, IE4 Additional window and navigator object userAgent form onmouseup N4, IE4 notations are: userLanguage IE4 length W4 — IE4+/Windows only userProfile IE4 name W5 — IE5+/Windows only vendorN6 typeN3, IE4 IE5 — IE5+ all OSes vendorSub N6 value W5.5 — IE5.5+/Windows only W6 — IE6+/Windows only mimeTypeN3,M4 38 pluginN3,M4 38 M4 — IE4+/Mac only M5 — IE5+/Mac only text, textarea, password, hidden 23 description (None) name refresh() N6 — New in NN6 & Mozilla enabledPlugin filename Except for items marked N4-Only (which are defaultValue (1) blur() onblur type description not carried over into NN6), an item listed for form focus() onchange suffixes length an early browser is also available in the IE4+ name handleEvent( evt)N4 onfocus and/or W3C DOM object models. typeN3, IE4 select() onkeydown N4, IE4 “(None)” means that no methods or events value (2) onkeypress N4, IE4 screenN4,IE4 38 exist for the current object through IE3 and onkeyup N4, IE4 NN4. onselect availHeight (None) (1) (1) Not available for textarea object. availLeft (1) (2) Password value property returns empty string in NN2. availTop availWidth bufferDepth(2) colorDepth N3,(1),IE4 file input control 24 fontSmoothingEnabled (2) height form blur() onblur pixelDepth name focus() onfocus updateInterval (2) N4 type handleEvent( evt) onselect width value select() (1)N4+ only. (1) Aso called the fileUpload object. (2)WinIE4+ only. 7

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. Page 2 of 4 — IE4+ DHTML DOM Quick Reference JSB5 FORM 21 A (anchor/link) 19 IMG 20

action reset() onreset hash align (None) onabort autocomplete W5 submit() onsubmit host alt onerror elements[] hostname border onload encoding href complete enctype Methods dynsrc length mimeType fileCreatedDate W4,M5 method name fileModifiedDate W4,M5 name nameProp fileSize W4,M5 target pathname fileUpdatedDate W5.5,M5 port height protocol href LABEL 35 protocolLong hspace rel isMap htmlFor (None) (None) rev loop search lowsrc BUTTON 22 target mimeType W6 urn name INPUT (button, reset, submit, radio, checkbox) namePropW5 protocol (See original object model button, reset, submit, radio, and checkbox object listings.) IE4+ DHTML DOM src start Compatibility Guide useMap INPUT (image) 22 The baseline browser for this section is vspace width complete (None) (None) MSIE 4. An item with no notation is form compatible back to that level for all name OS versions. Notations as follows: AREA 20 src W4 — IE4+/Windows only type W5 — IE5+/Windows only alt (None) (None) IE5 — IE5+ all OSes coords INPUT (text, password, hidden) 23 W5.5 — IE5.5+/ Windows only hash W6 — IE6+/Windows only host (See original object model text, password, and hidden object listings.) M5 — IE5+/Mac hostname W4 href maxLength (None) onafterupdate All HTML element objects share readOnly onbeforeupdate W4 noHref size onerrorupdateW4 items from “All HTML” box on Page 1. pathname “(None)” means no special methods or port events for the current object. protocol TEXTAREA 23 search shape (See original object model textarea object listing.) target cols createTextRange() onafterupdate W4 OL 37 readOnly onbeforeupdate W4 compact rows onerrorupdateW4 MAP 20 wrap start type areas[] (None) onscroll name SELECT 24 UL 37 (See original object model select object listing.) 35 length item(index [,subindex ]IE5 (None) compact MARQUEE W6 type multiple namedItem("id") behavior start() onbounce size options[i].add( elem[,index ]) bgColor stop() onfinish value options[i].remove() LI 37 direction onstart height OPTION 24 type hspace value loop defaultSelected (None) (None) scrollAmount form scrollDelay selected DL, DT, DD, DIR, MENU trueSpeed text vspace value compact width 9

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. Page 4 of 4 — IE4+ DHTML DOM Quick Reference JSB5 STYLE 26 event 25 APPLET 40

media (None) (None) altKey align (None) oncellchange W5 type altLeft IE5.5 altHTML ondataavailable W5 behaviorCookie W5.5 archive W6 ondatasetchanged W5 behaviorPart W5.5 code ondatasetcomplete W5 styleSheet 26 bookmarks W4 codeBase onload boundElements height onrowenterW5 cssText IE5 addImport("URL"[,index ]) (None) button hspace onrowexit W5 disabled addRule("selector ","styleSpec "[,index ]) cancelBubble name onrowsdelete W5 href removeRule( index ) clientX object onrowsinserted W5 id clientY vspace onscroll imports[] contentOverflow width media ctrlKey owningElement ctrlLeft IE5.5 pages[] W5.5 dataFldW4 OBJECT 40 parentStyleSheet dataTransferW5 readOnly fromElement align (None) oncellchange W5 rules[] keyCode altHTML ondataavailable W5 title nextPage W5.5 BaseHref ondatasetchanged W5 type offsetX classid ondatasetcomplete W5 offsetY code onload W5 codeBase onrowenterW5 IE5 W5.5 propertyName currentStyle , runtimeStyle 26 qualifier W4 codeType onrowexit W5 reasonW4 data onrowsdelete W5 (See style object) recordset W4 height onrowsinserted W5 repeatW5 hspace onscroll returnValue name rule 26 saveType W5.5 object screenX type readOnly (None) (None) screenY vspace selectorText shiftKey width style shiftLeft IE5.5 srcElement srcFilter W4 EMBED 40 srcUrnW5 toElement align (None) onload type height onscroll wheelData W6 hidden x name y pluginspage LINK 36 src units charset (None) onload width disabled href hreflang W5 media XML 41 rel src (None) (None) rev XMLDocument styleSheet W5 target type XMLHttpRequest(1) 41

readyState abort() (None) SCRIPT 36 responseText getAllResponseHeaders() responseXML getResponseHeader() status open() defer (None) (None) send() event statusText htmlFor (1) Supported in W5 (via ActiveX), N7, and Safari 1.2 src text type 11

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. Page 2 of 4 — W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference JSB5 FORM 21 SELECT 24 A (anchor/link) 19

acceptCharset (1) reset() onreset (See original object model select object listing.) charset (1) action submit() onsubmit disabled options[ i].remove() (None) coords (1) elements[] length hash encoding multiple host enctype size hostname length value href method hreflang(1) name 24 name target OPTION pathname port defaultSelected (None) (None) (1)Not implemented in IE through 6. protocol disabled rel form rev label M5,W6 search FIELDSET, LEGEND 21 selected shape (1) text target align (None) (None) value (1) form type OPTGROUP 24 (1)Not implemented in IE through 5.5. 35 LABEL form(1) (None) (None) label (1) AREA 20 accessKey (None) (None) M5,W6 form (1)Not implemented in IE/Windows through 6, but is implemented in IE5/Mac. alt htmlFor coords hash host hostname BUTTON 22 href IMG 20 noHref INPUT (button, reset, submit, radio, checkbox) pathname align (None) onAbort port (See original object model button, reset, submit, radio, and checkbox object listings.) alt onError protocol disabled border onLoad search complete shape height target INPUT (image) 22 href hspace disabled (None) (None) isMap MAP 20 form longDesc (1) lowsrc name areas lowSrc (1) src name type name naturalHeight, naturalWidth N6 src INPUT (text, password, hidden) 23 useMap vspace (See original object model text, password, and hidden object listings.) width disabled (None) (None) (1)Not implemented in IE through 6. maxLength readOnly size OL 37 UL 37 MARQUEE (1) 35 compact compact TEXTAREA 23 start type behavior start() type (See original object model textarea object listing.) direction stop() scrollAmount cols (None) (None) LI 37 scrollDelay disabled DL, DT, DD, DIR, MENU width readOnly type rows compact value (1)From IE, but implemented in N7/Mozilla. 13

© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. Page 4 of 4 — W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference JSB5 STYLE 26 event (1) 25

media (None) (None) altKey initEvent(" type",bubble ,cancelable ) (None) type bubbles initKeyEvent(" type", evtArgs ) button initMouseEvent(" type", evtArgs ) cancelBubble initMutationEvent(" type", evtArgs ) styleSheet 26 cancelable initUIEvent(" type", evtArgs ) charCode preventDefault() cssRules[] deleteRule( index )(1) (None) clientX stopPropagation() disabled insertRule("rule",index )(1) clientY href ctrlKey media currentTarget ownerNode(1) detail ownerRule(1) eventPhase parentStyleSheet isChar title keyCode type layerX layerY (1)Not implemented in IE through 5.5. metaKey originalTarget pageX cssRule 26 pageY relatedTarget cssText (2) (None) (None) (2) screenX parentStyleSheet screenY selectorText W3C DOM shiftKey style (1) target type Compatibility Guide timeStamp (1)Not implemented in IE through 6. Baseline browsers for this section are type (2)Not implemented in IE through 6, but implemented in IE5/Mac. IE5, NN6, Mozilla 1, and Safari 1. An item view with no notation is compatible with these (1)Not implemented in IE through 6. browsers (except occasionally Safari). Some items are new to Netscape 7 (N7) and Mozilla or WinIE6 (W6). Observe footnotes for items missing from IE, and see the book’s text for Safari details. All HTML element objects share items from “All HTML” box on Page 1. “(None)” means no special methods or events for the current EMBED 40 LINK 36 object. align (None) onload charset (None) (None) height onscroll disabled name href width hreflang media 40 OBJECT 40 rel APPLET rev align (1) align sheet altW6 altW6 target archive W6 baseURIN7 type code borderW6 (1)Not implemented in IE through 6. codeBase code data codeBase height codeType hspace contentDocument (1) SCRIPT 36 name height type hspace defer (None) (None) useMap W6 name event vspace object htmlFor width type src vspace text width type (1)Not implemented in IE through 6. 2

Core JavaScript/JScript/ECMAScript Quick Reference © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 Array N3,J2 30 String 27 Math(1) 28 Control Statements 31

constructor N4, IE4 concat( array2)N4, IE4 constructor N4, IE4 anchor("anchorName ") E abs(val ) if (condition ) { length join("char")IE4 length big() LN2 acos(val ) statementsIfTrue prototype push()N4, W5.5 prototype N4, J2 blink() LN10 asin(val ) } pop()N4, W5.5 bold() LOG2E atan(val ) reverse()IE4 charAt(index ) LOG10E atan2(val1 , val2 ) if (condition ) { shift()N4, W5.5 charCodeAt([i])N4, IE4 PI ceil( val ) statementsIfTrue slice(i,[j]) N4, IE4 concat( string2 )N4, IE4 SQRT1_2 cos(val ) } else { sort(compareFunc )IE4 fixed() SQRT2 exp(val ) statementsIfFalse splice(i,j[, items ])N4, W5.5 fontcolor(# rrggbb) floor(val ) } toLocaleString() N6, W5.5 fontsize(1to7) log(val ) toString()IE4 fromCharCode(n1...)(1),N4, IE4 max(val1 , val2 ) result = condition ? expr1 : expr2 unshift()N4, W5.5 indexOf("str" [,i]) min(val1 , val2 ) italics() pow(val1 , power) for ([init expr ]; [condition ]; [update expr]) { Date 29 lastIndexOf("str" [,i]) random() statements link( URL) round(val ) } constructor N4, IE4 getFullYear()N4, J2 localeCompare() N6, W5.5 sin(val ) prototype N3, IE4 getYear() match(regexp)N4, IE4 sqrt(val ) for (var in object ) { with (object ) { getMonth() replace(regexp,str)N4, IE4 tan(val ) statements statements N4, IE4 } } getDate() search(regexp) (1)All properties & methods are of the static Math object. getDay() slice( i,j)N4, IE4 getHours() small() while (condition ) { do { getMinutes() split( char)N3, (2), IE4 Number N3,J2 28 statements statements getSeconds() strike() } } while (condition )N4, IE4 getTime() sub() constructor N4, IE4 N6, W5.5 N4, J2 N4, IE4 toExponential( n) switch ( expression ) { getMilliseconds() substr(start,length ) MAX_VALUE IE4 N6, IE5.5 N4, J2 toFixed(n) case labelN : getUTCFullYear() substring( intA , intB ) MIN_VALUE IE4 N6, W5.5,M5 N4, J2 toLocaleString() statements getUTCMonth() sup() NaNIE4 N4, IE4 N4, J2 N6, W5.5 toString([radix]) [break] getUTCDate() toLocaleLowerCase() NEGATIVE_INFINITYIE4 N6, W5.5 N4, J2 N6, W5.5 toPrecision( n) ... getUTCDay() toLocaleUpperCase() POSITIVE_INFINITYIE4 N4, IE4 N4, J2 valueOf() getUTCHours() toLowerCase() prototype [default : getUTCMinutes()N4, J2 toString()N4, IE4 statements ] N4, IE4 getUTCSeconds() N4, J2 toUpperCase() } getUTCMilliseconds() N4, J2 valueOf()N4, IE4 N3,J2 33 setYear(val ) Function label : N4, IE4 (1)Method of the static String object. N4, IE4 setFullYear( val )N4, J2 (2)Added behavior in N4 includes: ability to accept a regexp N6, W5.5 continue [ label ] arguments apply( this , argsArray) N4, IE4 setMonth(val ) parameter; second parameter (limit integer) to limit the number of N4 N6, W5.5 break [label ] splits to be included; a space string parameter signifying any white arity call( this [,arg1[,...argN]]) setDate(val ) space character. caller toString() try { setDay(val ) constructor N4, IE4 valueOf() statements to test setHours(val ) length } setMinutes( val ) N4,IE4 prototype setSeconds( val ) Regular Expressions 42 [catch ( errorInfo) { setMilliseconds( val )N4, J2 statements if exception occurs in try block global compile( ) setTime(val ) regexp }] ignoreCase M5,W5.5 exec(" ")(2) setUTCFullYear(val )N4, J2 string [finally { input (1), IE5.5 test(" ") setUTCMonth(val )N4, J2 string Globals 34 statements to run, exception or not lastIndex .match( ) N6, W5 setUTCDate(val )N4, J2 str regexp }] multiline (1), W5.5 .replace( , ) setUTCDay(val )N4, J2 str regexp str Functions lastMatch (1), W5.5 .search( ) N6, W5.5 N6, W5 setUTCHours(val )N4, J2 str regexp decodeURI("encodedURI ") throw value lastParen (1), W5.5 .split( [, ]) N6, W5.5 setUTCMinutes( val )N4, J2 str regexp limit decodeURIComponent(" encComp ") leftContext (1),W5.5 N6, W5.5 setUTCSeconds( val )N4, J2 encodeURI("URIString") N4, J2 prototype encodeURIComponent(" compString ")N6, W5.5 setUTCMilliseconds( val ) (1) getTimezoneOffset() rightContext escape("string" [,1]) toDateString()W5.5 source eval("string") N6,W5 31 N4, IE4 Error toGMTString() $1...$9 isFinite( number) toLocaleDateString() W5.5, N6 (1)Property of the static RegExp object. isNaN(expression ) prototype toString() N4, IE4 toLocaleString() (2)Returns an array with properties: index, input, [0], [1],...[n]. Number(string) constructor toLocaleTimeString() W5.5, N6 parseFloat("string") description W5 parseInt("string" [,radix]) Statements fileName N6 toString() N3,J2 toTimeString()IE5.5 Boolean 28 toString([radix]) // /*...*/ lineNumber N6 N6 toUTCString()N4, J2 unescape("string") const message N6, IE5.5 N4 Date.parse("dateString ") constructor N4, IE4 toString()N4, IE4 unwatch(prop) var nameN6, IE5.5 N4 Date.UTC(date values ) prototype valueOf()N4, IE4 watch(prop, handler) numberW5 4

Original DOM (NN2+, IE3+) Quick Reference — Page 1 of 2 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 window 16 document 18 link ( ) 19

appCoreN6 alert("msg") onabortN6 alinkColor captureEvents( type)N4-Only (None) hash (None) onclick clientInformation IE4 attachEvent(" evt",func)IE5 onafterprintW5 anchors[] clear() host ondblclick N4,(1),IE4 clipboardData W5 back()N4 onbeforeprintW5 applets[] N3, IE4 close() hostname onmousedown N4, IE4 closed N3, IE4 blur()N3, IE4 onbeforeunload IE4 bgColor getSelection() N4,(2) href onmouseout N4, IE4 components[] N6 captureEvents(type) N4-Only onblurN3, IE4 cookie handleEvent( event)N4-Only pathname onmouseover controllers[] N6 clearInterval(ID) N4, IE4 onchange N6 domain N3, IE4 open("mimetype " [,replace ])(3) port onmouseup N4, IE4 crypto N6 clearTimeout(ID) onclick N6 embeds[] N3, IE4 releaseEvents( type)N4-Only protocol defaultStatus close() onclose N6 fgColor routeEvent(event)N4-Only search dialogArguments IE4 confirm("msg") ondragdropN4-Only forms[] write("string") target dialogHeight W4 createPopup()W5.5 onerrorN3, IE4 height N4 writeln("string") textN4-Only dialogLeft IE4 detachEvent(" evt",func)IE5 onfocus N3, IE4 images[] N3, IE4 xN4-Only dialogTop IE4 disableExternalCapture() N4-Only onhelp IE4 lastModified yN4-Only dialogWidth W4 enableExternalCapture() N4-Only onkeydown N6 layers[] N4-Only (1) Not implemented in NN4/Mac. directories N4,(S) execScript(" exprs"[,lang])IE4 onkeypress N6 linkColor document find(["str"][,case , bkwd])N4 onkeyup N6 links[] event IE4 fireEvent("evt"[,evtObj])W5.5 onload location (1) anchor ( ) 19 external W4 focus()N3, IE4 onmousesdown N6 referrer frameElement W5.5 forward() N4 onmousemove N6 title nameN4, IE4 (None) (None) frames[] handleEvent( event)N4-Only onmouseout N6 URLN3, IE4 textN4-Only history home()N4 onmouseover N6 vlinkColor xN4-Only innerHeight N4 moveBy(Dx,Dy)N4, IE4 onmouseup N6 widthN4 yN4-Only N4 N4, IE4 N4-Only innerWidth moveTo(x,y) onmove (1) Replaced by the URL property in Navigator 3. length N6, IE4 navigate() IE3 onresetN6 (2) M4 has a document.selection property to retrieve the currently selected text. loading N4-Only open(URL,"name","specs ")(1),(S) onresize N4, IE4 (3) mimetype parameter new in M4, but only "text/" type supported. N3,(1),IE4 20 location print()N4, IE5 onscroll IE4 image N4,(S) N6 N4-Only locationbar prompt("msg","reply") onselect layer 39 border (None) onabort N4,(S) N4-Only N6 menubar releaseEvents( type) onsubmit complete onerror N4-Only, IE4 name resizeBy(Dx,Dy) onunload above load("filename ", y) onblur height onload N6, IE4 N4-Only, IE4 navigator resizeTo(width,height ) background moveAbove( layerObj ) onfocus hspace IE4 N4-Only offscreenBuffering routeEvent(event) below moveBelow( layerObj ) onload lowsrc IE3, N3 N3, IE4 opener scroll( x,y) bgColor moveBy(Dx, Dy) onmouseout name N4 N4, IE4 outerHeight scrollBy(D x,Dy) clip.bottom moveTo(x, y) onmouseover src N4 N4, IE4 outerWidth scrollTo( x,y) clip.height moveToAbsolute( x, y) onmouseup vspace N4 W5.5 pageXOffset setActive() clip.left resizeBy(Dx, Dy) width N4 N4,IE4,(2) pageYOffset setInterval( func, msec [,args]) clip.right resizeTo(width, height ) xN4-Only (2) parent setTimeout( func, msec [,args]) clip.top yN4-Only personalbar N4,(S) showHelp()W4 clip.width pkcs11 N6 showModalDialog() IE4 document (1) Implemented in IE3.01/Macintosh but not Windows until IE4. prompterN6 showModelessDialog() W5 left returnValue W4,M5 sizeToContent() N6 name N3,IE4 20 screen N6, IE4 stop()N4 pageX area W5 screenLeft pageY hash N4 W5 (None) onclick screenTop parentLayer host N6 onmouseout screenX siblingAbove hostname N6 onmouseover screenY siblingBelow href N4,(S) scrollbars src pathname N6 scrollX top port N6 scrollY visibility protocol self zIndex search N4,(S) sidebar target status location 17 statusbar N4,(S) N4,(S) toolbar hash assign(" URL") (None) history 17 top host reload([unconditional ])N3,IE4 window N3,IE4 hostname replace("URL") current(S),(1) back() (None) (1)New window specs for all browsers: height, width, toolbar, location, directories, status, menubar, href length forward() scrollbars, resizable, copyhistory. Add'l specs for N4+: alwaysLowered(S), alwaysRaised(S), pathname next(S),(1) go(int | "URL") dependent, hotkeys, innerHeight, innerWidth, outerHeight, outerWidth, screenX, screenY, titlebar(S), port z-lock(S). Add'l specs for IE4+: channelmode, fullscreen, left, top. Add'l spec for IE5+: title. previous (S),(1) N6 + includes left, top. protocol (2)Optional args parameter added to N4; 3rd parameter in IE4 is for scripting language. search (1) Available in NN4+/Mozilla with signed scripts. 6

IE4+ DHTML DOM Quick Reference — Page 1 of 4 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 All HTML Elements 15 FRAMESET 16 document 18 accessKey addBehavior("URL") W5 onactivate W5.5 border activeElement attachEvent(" evt",func)IE5 onactivate W5.5 all[] applyElement( elem[,type])W5 onbeforecopy W5 borderColor alinkColor clear() onbeforecut W5 behaviorUrns[] W5 attachEvent(" evt",func)W5 onbeforecut W5 cols all clearAttributes() IE5 onbeforedeactivate W5.5 canHaveChildren W5 blur() onbeforedeactivate W5.5 frameBorder anchors[] close() onbeforeeditfocus W5 canHaveHTML W5.5 clearAttributes() W5 onbeforeeditfocus W5 frameSpacing applets[] createElement(" tag") onbeforepaste W5 children click() onbeforepaste W5 rows bgColor createEventObject([ evt])W5.5 onclick className componentFromPoint( x,y)W5 onblur body createStyleSheet([" URL"[,index ]]) oncontextmenu W5 clientHeight contains( elem) onclick charset detachEvent(" evt",func)IE5 oncontrolselect W5.5 clientLeft detachEvent(" evt",func) W5 oncontextmenu W5 FRAME 16 compatMode W6 elementFromPoint( x,y) oncut clientTop fireEvent("evt"[,evt])W5.5 oncontrolselect W5.5 cookie execCommand(" cmd"[,UI][,arg]) ondblclick clientWidth focus() oncopy W5 allowTransparency W6 defaultCharset focus() ondeactivate W5.5 contentEditable W5.5 getAdjacentText() W5 oncut W5 borderColor designMode W5 mergeAttributes( obj)W5 ondragW5 currentStyle IE5 getAttribute("attr"[,case ]) ondblclick contentWindow W5.5 doctype M5 open(["mimeType "[,replace ]) ondragendW5 dataFld W4,M5 getBoundingClientRect() W5 ondeactivate W5.5 frameBorder domain queryCommandEnabled(" cmd") ondragenterW5 dataFormatAs W4,M5 getClientRects() W5 ondragW5 height, width embeds[] queryCommandIndterm("cmd") ondragleave W5 dataSrc W4,M5 getExpression() W5 ondragendW5 marginHeight W6,M5 expando queryCommandState(" cmd") ondragoverW5 disabled insertAdjacentElement() W5 ondragenterW5 marginWidth W6,M5 fgColor queryCommandSupported(" cmd") ondragstartW5 document insertAdjacentHTML() ondragleave W5 name fileCreatedDate queryCommandText("cmd") ondropW5 filters[] W4 insertAdjacentText() ondragoverW5 noResize fileModifiedDate queryCommandValue(" cmd") onhelp W4,M5 hideFocus W5.5 item(index [,subindex ])(1) ondragstartW5 scrolling fileSize recalc( allFlag )W5 onkeydown id mergeAttributes() W5 ondropW5 src forms[] releaseCapture() IE5 onkeypress innerHTML releaseCapture()W5 onfilterchange W4 frames[] setActive() W5.5 onkeyup innerText removeAttribute("attr"[,case ]) onfocus images[] write("str") onmousedown isContentEditable W5.5 removeBehavior( ID)W5 onfocusin W6(2) IFRAME 16 lastModified writeln("str") onmousemove isDisabled W5.5 removeExpression(" prop")W5 onfocusout W6(2) linkColor onmouseout isMultiLine W5.5 removeNode(children )W5 onhelp W4,M5 align links[] onmouseover isTextEdit W4 replaceAdjacentText(" loc ","txt") W5 onkeydown allowTransparency W6 location onmouseup lang replaceNode( new)W5 onkeypress contentWindow W5.5 media W5.5 onpaste language scrollIntoView( top) onkeyup height, width mimeType W5 onpropertychange W5 length (1) setActive() W5.5 onlosecapture W5 hspace, vspace namePropW6 onreadystatechange offsetHeight setAttribute("attr",val [,case ]) onmousedown longdesc W6,M5 namespaces[] W5.5 onresizeend W5.5 offsetLeft setCapture(container )W5 onmouseenter W5.5 marginHeight parentWindow onresizestart W5.5 offsetParent setExpression(" prop","expr","lang") W5 onmouseleave W5.5 marginWidth plugins[] onselectionchange W5.5 offsetTop swapNode(node)W5 onmousemove name protocol onstop IE5 offsetWidth tags("tag") (1) onmouseout scrolling readyState outerHTML urns("URN")W5,(1) onmouseover src referrer outerText onmouseup scripts[] parentElement onmousewheel W6 security W5.5 parentTextEdit onmove W5.5(2) BASE 36 selection readyState onmoveend W5.5(2) styleSheets[] recordNumberW4 onmovestart W5.5(2) href title runtimeStyle IE5 onpaste W5 target uniqueID scopeName W5 onpropertychange W5 URL scrollHeight onreadystatechange URLUnencoded W5.5 scrollLeft onresize BASEFONT 36 vlinkColor scrollTop onresizeend W5.5 scrollWidth onresizestart W5.5 color sourceIndex onselectstart face BODY 18 style size tabIndex alink createControlRange()W5 onAfterPrint W5 W5 tagName 36 background createTextRange() onBeforePrint tagUrnW5 META bgColor doScroll([" scrollAction "])W5 onScroll title charset bgProperties uniqueID W5 content bottomMargin httpEquiv leftMargin, rightMargin (1)Property or method of all object collections. (2)IE content editing mode only. name link url noWrap scroll popupW5.5 16 scrollLeft, scrollTop TITLE 36 text document hide() (None) topMargin isOpen show() text vLink 8

IE4+ DHTML DOM Quick Reference — Page 3 of 4 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 TABLE 37 H1...H6 35 TextRangeW4 35

align createCaption() onscroll align boundingHeight collapse([ start]) (None) background createTFoot() boundingLeft compareEndPoints(" type",range) bgColor createTHead() boundingTop duplicate() border deleteCaption() HR 35 boundingWidth execCommand(" cmd"[,UI[,val ]]) borderColor deleteRow(i) htmlText expand("unit") borderColorDark deleteTFoot() align offsetLeft findText("str"[,scope ,flags ]) borderColorLight deleteTHead() color offsetTop getBookmark() caption firstPage()IE5 noShade text getBoundingClientRect() cellPadding insertRow(i) size getClientRects() cells[] W5 lastPage() IE5 width inRange(range) cellSpacing moveRow(srcIndex ,destIndex )W5 isEqual( range) cols[] nextPage()W4,M5 BR 35 move("unit"[,count]) datePageSize previousPage() W4,M5 moveEnd("unit"[,count]) frame refresh() clear moveStart("unit"[,count]) height moveToBookmark(" bookmark ") rows[] moveToElementText( elem) rules FONT 35 moveToPoint( x,y) tBodies[] parentElement() tFoot color pasteHTML("HTMLText") tHead face queryCommandEnabled(" cmd") width size queryCommandIndeterm("cmd") queryCommandState(" cmd") queryCommandSupported(" cmd") TBODY, TFOOT, THEAD 37 queryCommandText("cmd") queryCommandValue(" cmd") align deleteRow(i) (None) scrollIntoView() bgColor insertRow(i) select() rows moveRow(srcIndex ,destIndex ) setEndPoint(" type",range) vAlign IE4+ DHTML DOM TextNode IE5 35 TR 37 Compatibility Guide The baseline browser for this section is data appendData("text")M5,W6 (None) M5,W6 align deleteCell( i) (None) MSIE 4. An item with no notation is length deleteData(start, count) nextSibling M5,W6 bgColor insertCell( i) compatible back to that level for all insertData(start, "text") nodeName replaceData( start, count, "text")M5,W6 borderColor OS versions. Notations as follows: borderColorDark nodeType splitText( offset)M5,W6 borderColorLight W4 — IE4+/Windows only nodeValue substringData( start, count)M5,W6 cells[] W5 — IE5+/Windows only parentNode height IE5 — IE5+ all OSes previousSibling rowIndex W5.5 — IE5.5+/Windows only sectionRowIndex M5 — IE5+/Mac W4 vAlign All HTML element objects share selection 35 items from “All HTML” box on Page 1. “(None)” means no special methods or type clear() (None) TD, TH 37 COL, COLGROUP 37 typeDetail W5.5 createRange() events for the current object. empty() align align This Quick Reference does not contain background span listings for Microsoft’s separate XML DOM. bgColor vAlign TextRectangleW5 35 borderColor width borderColorDark bottom (None) (None) borderColorLight left cellIndex right colSpan top height noWrap CAPTION 37 rowSpan vAlign align width vAlign 10

W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference — Page 1 of 4 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 All HTML Elements 15 HEAD 36 document 18

attributes[] addEventListener(" evt",func,capt)(2) onblur profile (1) alinkColor clear() onblur childNodes[] appendChild( elem) onclick anchors[] onclick (1)Not implemented in IE through 6. close() className blur() oncontextmenu (1) applets[] createAttribute("name") ondblclick clientHeight (1) click() ondblclick attributes[] createComment("text")W6 onfocus (1) bgColor W6 clientLeft cloneNode( deep) onfocus 36 createDocumentFragment() onkeydown clientTop (1) dispatchEvent( evt)(2) onkeydown BASE body createElement(" tag") onkeypress clientWidth (1) focus() onkeypress characterSet (1) (1) onkeyup href createEvent("type") dir getAttribute("attr") onkeyup childNodes[] (1) onmousedown target createRange() firstChild getAttributeNode("attr")W6 onmousedown compatMode W6,N7 createTextNode("txt") onmousemove id getAttributeNodeNS(" nsuri","local ")(2) onmousemove cookie createTreeWalker( root, what, onmouseout innerHTML(1) getAttributeNS("nsuri","local ")(2) onmouseout defaultView (1) filterFunc , expand )N7,(1) onmouseover lang getElementsByTagName(" tag") onmouseover BASEFONT 36 doctype (1) focus() onmouseup lastChild hasAttribute("attr")(2) onmouseup documentElement getElementById(" ID") onresize color length (3) hasAttributeNS(" nsuri","local ")(2) onresize domain getElementsByName(" name") face localName hasAttributes() (2) embeds[] getElementsByTagName(" tag") size namespaceURI hasChildNodes() fgColor open("mimeType "[,replace ]) nextSibling insertBefore( new[,ref]) firstChild write("str") nodeName isSupported("feature","ver")(2) forms[] writeln("str") nodeType item(index )(3) META 36 height (1) nodeValue normalize() (2) images[] charset offsetHeight (1) removeAttribute("attr") implementation (1) content offsetLeft (1) removeAttributeNode( node)(2) lastChild httpEquiv offsetParent (1) removeChild( node) lastModified name offsetTop (1) removeEventListener(" evt",func,capt)(2) linkColor scheme M5,W6 offsetWidth (1) replaceChild( new,old) links[] url ownerDocument scrollIntoView() (1) location parentNode setAttribute("attr",val ) namespaceURI prefix setAttributeNode( node)(2) TITLE 36 nextSibling previousSibling nodeName (1) scrollHeight, scrollLeft, scrollTop, scrollWidth text nodeType style ownerDocument (1) tabIndex parentNode tagName plugins[] title W3C DOM previousSibling (1)Non-W3C item originated in IE4 Object Model, but implemented in N6+/Moz/Saf for convenience. referrer (2)Not implemented in IE through 6. (3)Property or method of all object collections. Compatibility Guide styleSheets[] Baseline browsers for this section are title IE5, NN6, Mozilla 1, and Safari 1. An URL item with no notation is compatible with vlinkColor (1) these browsers (except occasionally width Safari). Some items are new to Netscape (1)Not implemented in IE through 6. 7 (N7) and Mozilla or WinIE6 (W6). Observe footnotes for items missing FRAMESET 16 from IE, and see the book’s text for Safari details. All HTML element objects BODY 18 cols (None) (None) share items from “All HTML” box on rows Page 1. “(None)” means no special alink (None) (None) methods or events for the current object. background bgColor FRAME 16 link scrollLeft, scrollTop N7,(1) contentDocument (1) (None) (None) IFRAME 16 text contentWindow N7 vLink frameBorder align (1)Originated in IE Object Model, but implemented in N7/Mozilla for convenience. longDesc M5,N6 contentDocument (1) marginHeight, marginWidth longDesc M5,W6 name marginHeight noResize marginWidth HTML 36 scrolling scrolling src src version (1) (None) (None) (1)Not implemented in IE through 6. (1)Not implemented in IE through 6. (1)Not implemented in IE through 6. 12

W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference — Page 3 of 4 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 TABLE 37 H1...H6 35 Range(1) 35

align createCaption() onscroll align collapsed cloneContents() N7 (None)(None) bgColor createTFoot() commonAncestorContainer cloneRange() N7 border createTHead() endContainer collapse([ start]) N7 caption deleteCaption() 35 endOffset compareBoundaryPoints( type,src) cellPadding deleteRow(i) HR startContainer compareNode(node) cellSpacing deleteTFoot() align startOffet comparePoint( node, offset) frame deleteTHead() color createContextualFragment(" text") height insertRow(i) noShade deleteContents() rows[] detach() size N7 rules width extractContents() summary W6 insertNode(node)N7 tBodies intersectsNode( node) tFoot 35 isPointInRange( node, offset) tHead BR selectNode( node) width clear selectNodeContents( node) setEnd(node,offset) setEndAfter( node) 35 setEndBefore( node) FONT setStart(node,offset) TBODY, TFOOT, THEAD 37 color setStartAfter(node) setStartBefore( node) align deleteRow(i) (None) face N7 size surroundContents( node) bgColor insertRow(i) toString() chW6 chOffW6 (1)Not implemented in IE through 6. rows BLOCKQUOTE, Q 35 vAlign cite M5,W6

TR 37 Text (1) 35

align deleteCell( i) (None) data appendData("text") (None) bgColor insertCell( i) length deleteData(offset,count) cells[] insertData(offset,"text") chW6 replaceData( offset,count,"text") chOffW6 splitText( offset) rowIndex substringData( offset,count) sectionRowIndex (1)Not implemented in IE through 6. vAlign

TD, TH 37 COL, COLGROUP 37 selection(1) 35 abbrM5,W6 align align chW6 anchorNode addRange(range) (None) axis M5,W6 chOffW6 anchorOffset clearSelection() background span Node Types focusNode collapse( node,offset) ELEMENT_NODE 1 bgColor vAlign focusOffset collapseToEnd() ATTRIBUTE_NODE 2 cellIndex width isCollapsed collapseToStart() chW6 TEXT_NODE 3 rangeCount containsNode( node,recurse) chOffW6 CDATA_SECTION_NODE 4 deleteFromDocument() colSpan ENTITY_REFERENCE_NODE 5 extend(node,offset) headersM5,W6 ENTITY_NODE 6 getRangeAt() height PROCESSING_INSTRUCTION_NODE 7 removeAllRanges() noWrap CAPTION 37 COMMENT_NODE 8 removeRange(range) rowSpan DOCUMENT_NODE 9 selectAllChildren( node) vAlign align DOCUMENT_TYPE_NODE 10 toString() width vAlign DOCUMENT_FRAGMENT_NODE 11 NOTATION_NODE 12 (1)Not implemented in IE through 6. If JavaScript can do it, you can do it too . . . Create Web pages brimming with dynamic content. Engage your site visitors with programmed style sheets that respond instantly to user interaction. Take charge of your user interface by controlling CSS, plug-ins, Java™ applets, and even XML data. Premier JavaScript authority Danny Goodman teams up with developer/inventor Michael Morrison to help you bring your pages to life, whether you’re a beginner or a JavaScript pro. You’ll find what you need in this extensively revised edition — an updated, standards-intensive tutorial for newcomers, and plenty of advanced detail for veterans.

Inside, you’ll find complete coverage of JavaScript • Get up to speed fast on JavaScript basics with an updated tutorial tailored for newcomers • Master JavaScript and DOM concepts with Danny Goodman’s exclusive interactive workbench, The Evaluator • Apply scripting to Web standards — XHTML, DOM, CSS, and XML — to produce future-compatible pages • Implement cross-browser dynamic HTML applications for MSIE 6, Mozilla™, Safari™, and other browsers • Energize your content with custom objects, XML data, and other client-side techniques • Learn in depth from hundreds of fully scripted example HTML pages

The New 5th Edition of the Bestseller Published March 2004 ISBN 0-7645-5743-2