首页 JavaScript and Browser Objects Quick Reference

JavaScript and Browser Objects Quick Reference

举报
开通vip

JavaScript and Browser Objects Quick Reference JavaScript Bible 5th Edition Danny Goodman Appendix A JavaScript and Browser Objects Quick Reference ©2004 Danny Goodman (www.dannyg.com). All Rights Reserved. 18 February 2004 This guide contains quick reference info for the core JavaScript language, ...

JavaScript and Browser Objects Quick Reference
JavaScript Bible 5th Edition Danny Goodman Appendix A JavaScript and Browser Objects Quick Reference ©2004 Danny Goodman (www.dannyg.com). All Rights Reserved. 18 February 2004 This guide contains quick reference info for the core JavaScript language, the original document object model (2 pp), the IE4+DHTML object model (4 pp), and the W3C DOM object model(4 pp) as implemented in IE5+, NN6, Mozilla, and Safari browsers. All- uppercase object names refer to HTML elements (IE4+ and W3C DOMs). The three columns in each box list the object’s properties,methods, and event handlers in that order. Read the compatibility guides for each section. Numbers in the upper right corners of object squares are chapter numbers in which the object is covered in detail. Basic browser and operating system notation codes are as follows: N — Netscape Navigator (including Mozilla when N6 or higher) IE — MS Internet Explorer W — Windows MSIE M — Macintosh MSIE See the accompanying file for printing and collating instructions in booklet or broadside configurations. JavaScript and Browser Objects Quick Reference Appendix A JavaScript Bible, 5th Edition by Danny Goodman How to Use This Quick Reference Comparison == Equals === N4, IE4Strictly equals != Does not equal !== N4, IE4 Strictly does not equal > Is greater than >= Is greater than or equal to < Is less than <= Is less than or equal to Arithmetic + Plus (and string concat.) - Minus * Multiply / Divide % Modulo ++ Increment -- Decrement -val Negation Assignment = Equals += Add by value -= Subtract by value *= Multiply by value /= Divide by value %= Modulo by value <<= Left shift by value >>= Right shift by value >>>= Zero fill by value &= Bitwise AND by value |= Bitwise OR by value ^= Bitwise XOR by value Boolean && AND || OR ! NOT Bitwise & Bitwise AND | Bitwise OR ^ Bitwise XOR ~ Bitwise NOT << Left shift >> Right shift >>> Zero fill right shift Miscellaneous , Series delimiter deleteN4, IE4 Property destroyer inN6, W5.5 Item in object instanceofN6,W5 Instance of new Object creator this Object self-reference typeofN3, IE3 Value type voidN3, IE3 Return no value Operators 3 Text & Fonts colorIE4, N6 fontIE4, N6 fontFamilyIE4, N6 fontSizeIE4, N6 fontSizeAdjustM5, N6 fontStretchM5, N6 fontStyleIE4, N6 fontVariantIE4, N6 fontWeightIE4, N6 letterSpacingIE4, N6 lineBreakIE5 lineHeightIE4, N6 quotesM5, N6 rubyAlignIE5 rubyOverhangIE5 rubyPositionIE5 textAlignIE4, N6 textAlignLastIE5.5 textAutospaceW5 textDecorationIE4, N6 textDecorationBlinkIE-Only textDecorationLineThroughIE-Only textDecorationNoneIE-Only textDecorationOverlineIE-Only textDecorationUnderlineIE-Only textIndentIE4, N6 textJustifyIE5 textJustifyTrimIE5 textKashidaSpaceIE5.5 textOverflowW6 textShadowM5, N6 textTransformIE4, N6 textUnderlinePositionIE5.5 unicodeBidiIE5, N6 whiteSpaceIE4, N6 wordBreakW5 wordSpacingM4, N6, W6 wordWrapW5.5 writingModeW5.5 styleIE4,N6 Inline Display & Layout clearIE4, N6 clipIE4, N6 clipBottomW5 clipLeftW5 clipRightW5 clipTopW5 contentM5, N6 counterIncrementM5, N6 counterResetM5, N6 cssFloatM5, N6 cursorIE4, N6 directionIE5, N6 displayIE4, N6 filterW4 layoutGridW5 layoutGridCharW5 layoutGridLineW5 layoutGridModeW5 layoutGridTypeW5 markerOffsetM5, N6 marksM5, N6 maxHeightM5, N6 maxWidthM5, N6 minHeightM5, N6, W6 minWidthM5, N6 MozOpacityN6 overflowIE4, N6 overflowXW5 overflowYW5 styleFloatIE-Only verticalAlignIE4, N6 visibilityIE4, N6 widthIE4, N6 zoomW5.5 Lists listStyleIE4, N6 listStyleImageIE4, N6 listStylePositionIE4, N6 listStyleTypeIE4, N6 Scrollbars scrollbar3dLightColorW5.5 scrollbarArrowColorW5.5 scrollbarBaseColorW5.5 scrollbarDarkShadowColorW5.5 scrollbarFaceColorW5.5 scrollbarHighlightColorW5.5 scrollbarShadowColorW5.5 scrollbarTrackColorW5.5 Miscellaneous acceleratorW5 behaviorW5 cssTextIE4, N6 imeModeW5 Printing orphansM5, N6 widowsM5, N6 pageM5, N6 pageBreakAfterIE4, N6 pageBreakBeforeIE4, N6 pageBreakInsideM5, N6 sizeN6 Tables borderCollapseM5, N6 borderSpacingM5, N6 captionSideM5, N6 emptyCellsM5, N6 tableLayoutIE5, N6 Borders & Edges borderIE4, N6 borderBottomIE4, N6 borderLeftIE4, N6 borderRightIE4, N6 borderTopIE4, N6 borderBottomColorIE4, N6 borderLeftColorIE4, N6 borderRightColorIE4, N6 borderTopColorIE4, N6 borderBottomStyleIE4, N6 borderLeftStyleIE4, N6 borderRightStyleIE4, N6 borderTopStyleIE4, N6 borderBottomWidthIE4, N6 borderLeftWidthIE4, N6 borderRightWidthIE4, N6 borderTopWidthIE4, N6 borderColorIE4, N6 borderStyleIE4, N6 borderWidthIE4, N6 marginIE4, N6 marginBottomIE4, N6 marginLeftIE4, N6 marginRightIE4, N6 marginTopIE4, N6 outlineM5, N6 outlineColorM5, N6 outlineStyleM5, N6 outlineWidthM5, N6 paddingIE4, N6 paddingBottomIE4, N6 paddingLeftIE4, N6 paddingRightIE4, N6 paddingTopIE4, N6 Background backgroundIE4, N6 backgroundAttachmentIE4, N6 backgroundColorIE4, N6 backgroundImageIE4, N6 gackgroundPositionIE4, N6 backgroundPositionXIE-Only backgroundPositionYIE-Only backgroundRepeatIE4, N6 Positioning bottomIE5, N6 heightIE4, N6 leftIE4, N6 pixelBottomIE/W-Only pixelHeightIE-Only pixelLeftIE-Only pixelRightIE/W-Only pixelTopIE-Only pixelWidthIE-Only posBottomIE/W-Only posHeightIE-Only posLeftIE-Only posRightIE/W-Only posTopIE-Only posWidthIE-Only positionIE4, N6 rightIE5, N6 topIE4, N6 widthIE4, N6 zIndexIE4, N6 IE4+, NN6+ style Object Properties © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 32 26 5 Page 2 of 2 — Original DOM (NN2+, IE3+) Quick Reference © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 Original DOM Compatibility Guide Baseline browsers for this section are NN2, WinIE3/J1, and MacIE3.01. An item with no notation is compatible back to that level, and is found in all new scriptable browsers since then. Notations indicate the browser and version in which the property, method, or event handler was introduced. Except for the window and navigator objects (whose listings cover all browsers and versions), new features listed in this section cover only through NN4 (and IE4 when they matched a new NN4 feature). Notations are as follows: N3 — New in NN3 N4 — New in NN4 J2 — New in IE3, JScript.dll ver.2 IE4 — New in IE4, all OSes (S) — Requires signed scripts (NN) Additional window and navigator object notations are: W4 — IE4+/Windows only W5 — IE5+/Windows only IE5 — IE5+ all OSes W5.5 — IE5.5+/Windows only W6 — IE6+/Windows only M4 — IE4+/Mac only M5 — IE5+/Mac only N6 — New in NN6 & Mozilla Except for items marked N4-Only (which are not carried over into NN6), an item listed for an early browser is also available in the IE4+ and/or W3C DOM object models. “(None)” means that no methods or events exist for the current object through IE3 and NN4. action elements[] encoding length method name target handleEvent(evt)N4 reset()N3, IE4 submit() onresetN3, IE4 onsubmit form 21 form name typeN3, IE4 value click() handleEvent(evt)N3 button, reset, submit onclick onmousedownN4, IE4 onmouseupN4, IE4 22 checked defaultChecked form name typeN3, IE4 value click() handleEvent(evt)N3 checkbox onclick onmousedownN4, IE4 onmouseupN4, IE4 22 checked defaultChecked form length name typeN3, IE4 value click() handleEvent(evt)N3 radio onclick onmousedownN4, IE4 onmouseupN4, IE4 22 length name options[i] options[i].defaultSelected options[i].index options[i].selected options[i].text options[i].value selectedIndex typeN3, IE4 blur()N3, IE4 focus()N3, IE4 handleEvent(evt)N4 select onblur onchange onfocus 24 appCodeName appMinorVersionIE4 appName appVersion browserLanguageIE4 cookieEnabledN6, IE4 cpuClassIE4 languageN4 mimeTypes[]N3, M4 onLineIE4 oscpuN6 platformN4, IE4 plugins[]N3, M4 productN6 productSubN6 securityPolicyN4 systemLanguageIE4 userAgent userLanguageIE4 userProfileIE4 vendorN6 vendorSubN6 javaEnabled()N3, M4 preference(name[, val ])N4,(S) taintEnabled()N3, IE4 navigator 38 description enabledPlugin type suffixes (None) N3,M4mimeType 38 name filename description length refresh() pluginN3,M4 38 (1)N4+ only. (2)WinIE4+ only. availHeight availLeft(1) availTop(1) availWidth bufferDepth(2) colorDepth fontSmoothingEnabled(2) height pixelDepth updateInterval(2) width (None) screenN4,IE4 38 (1) Not available for textarea object. (2) Password value property returns empty string in NN2. defaultValue(1) form name typeN3, IE4 value(2) blur() focus() handleEvent(evt)N4 select() text, textarea, password, hidden onblur onchange onfocus onkeydownN4, IE4 onkeypressN4, IE4 onkeyupN4, IE4 onselect 23 (1) Aso called the fileUpload object. form name type value blur() focus() handleEvent(evt)N4 select() N3,(1),IE4file input control onblur onfocus onselect 24 7 htmlFor (None)(None) LABEL BUTTON INPUT (button, reset, submit, radio, checkbox) (See original object model button, reset, submit, radio, and checkbox object listings.) complete form name src type (None)(None) INPUT (image) hash host hostname href Methods mimeType name nameProp pathname port protocol protocolLong rel rev search target urn A (anchor/link) compact start type OL compact type UL type value LI compact DL, DT, DD, DIR, MENU Page 2 of 4 — IE4+ DHTML DOM Quick Reference © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 IE4+ DHTML DOM Compatibility Guide The baseline browser for this section is MSIE 4. An item with no notation is compatible back to that level for all OS versions. Notations as follows: W4 — IE4+/Windows only W5 — IE5+/Windows only IE5 — IE5+ all OSes W5.5 — IE5.5+/ Windows only W6 — IE6+/Windows only M5 — IE5+/Mac All HTML element objects share items from “All HTML” box on Page 1. “(None)” means no special methods or events for the current object. defaultSelected form selected text value (None) OPTION (None) action autocompleteW5 elements[] encoding enctype length method name target onreset onsubmit reset() submit() FORM 21 35 22 22 maxLength readOnly size onafterupdateW4 onbeforeupdateW4 onerrorupdateW4 (None) INPUT (text, password, hidden) (See original object model text, password, and hidden object listings.) 23 cols readOnly rows wrap onafterupdateW4 onbeforeupdateW4 onerrorupdateW4 createTextRange() TEXTAREA (See original object model textarea object listing.) 23 length multiple size value (None)item(index [,subindex ]IE5 namedItem("id")W6 options[i].add(elem [,index ]) options[i].remove() SELECT (See original object model select object listing.) 24 24 37 37 37 19 align alt border complete dynsrc fileCreatedDateW4,M5 fileModifiedDateW4,M5 fileSizeW4,M5 fileUpdatedDateW5.5,M5 height href hspace isMap loop lowsrc mimeTypeW6 name namePropW5 protocol src start useMap vspace width onabort onerror onload (None) IMG 20 alt coords hash host hostname href noHref pathname port protocol search shape target (None)(None) AREA 20 areas[] name onscroll(None) MAP 20 behavior bgColor direction height hspace loop scrollAmount scrollDelay trueSpeed vspace width onbounce onfinish onstart start() stop() MARQUEE 35 altKey altLeftIE5.5 behaviorCookieW5.5 behaviorPartW5.5 bookmarksW4 boundElements button cancelBubble clientX clientY contentOverflow ctrlKey ctrlLeftIE5.5 dataFldW4 dataTransferW5 fromElement keyCode nextPageW5.5 offsetX offsetY propertyNameW5 qualifierW4 reasonW4 recordsetW4 repeatW5 returnValue saveTypeW5.5 screenX screenY shiftKey shiftLeftIE5.5 srcElement srcFilterW4 srcUrnW5 toElement type wheelDataW6 x y event media type (None)(None) STYLE cssTextIE5 disabled href id imports[] media owningElement pages[]W5.5 parentStyleSheet readOnly rules[] title type (None)addImport("URL"[,index ]) addRule("selector ","styleSpec "[,index ]) removeRule(index ) styleSheet readOnly selectorText style (None)(None) rule (See style object) currentStyle , runtimeStyleIE5 W5.5 align height hidden name pluginspage src units width onload onscroll (None) EMBED align altHTML archiveW6 code codeBase height hspace name object vspace width oncellchangeW5 ondataavailableW5 ondatasetchangedW5 ondatasetcompleteW5 onload onrowenterW5 onrowexitW5 onrowsdeleteW5 onrowsinsertedW5 onscroll (None) APPLET align altHTML BaseHref classid code codeBase codeType data height hspace name object type vspace width oncellchangeW5 ondataavailableW5 ondatasetchangedW5 ondatasetcompleteW5 onload onrowenterW5 onrowexitW5 onrowsdeleteW5 onrowsinsertedW5 onscroll (None) OBJECT charset disabled href hreflang media rel rev styleSheetW5 target type onload(None) LINK defer event htmlFor src text type (None)(None) SCRIPT 9 Page 4 of 4 — IE4+ DHTML DOM Quick Reference © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 36 36 26 26 26 26 25 40 40 40 src XMLDocument (None)(None) XML 41W5 readyState responseText responseXML status statusText (None)abort() getAllResponseHeaders() getResponseHeader() open() send() XMLHttpRequest 41(1) (1) Supported in W5 (via ActiveX), N7, and Safari 1.2 charset(1) coords(1) hash host hostname href hreflang(1) name pathname port protocol rel rev search shape(1) target type(1) A (anchor/link) (1)Not implemented in IE through 5.5. 11 Page 2 of 4 — W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 19 areas name MAP 20 alt coords hash host hostname href noHref pathname port protocol search shape target AREA 20 align alt border complete height href hspace isMap longDesc(1) lowsrc lowSrc(1) name naturalHeight, naturalWidthN6 src useMap vspace width onAbort onError onLoad (None) IMG (1)Not implemented in IE through 6. compact start type OL compact type UL type value LI compact DL, DT, DD, DIR, MENU acceptCharset(1) action elements[] encoding enctype length method name target onreset onsubmit reset() submit() FORM (1)Not implemented in IE through 6. 21 align form (None)(None) FIELDSET, LEGEND 21 accessKey formM5,W6 htmlFor (None)(None) LABEL 35 disabled form name src type (None)(None) INPUT (image) 22 disabled maxLength readOnly size (None)(None) INPUT (text, password, hidden) (See original object model text, password, and hidden object listings.) 23 cols disabled readOnly rows (None)(None) TEXTAREA (See original object model textarea object listing.) 23 37 37 37 20 form(1) label(1) (None)(None) OPTGROUP (1)Not implemented in IE/Windows through 6, but is implemented in IE5/Mac. 24 defaultSelected disabled form labelM5,W6 selected text value (None)(None) OPTION 24 disabled length multiple size value (None)options[i].remove() SELECT (See original object model select object listing.) 24 BUTTON INPUT (button, reset, submit, radio, checkbox) 22 disabled (See original object model button, reset, submit, radio, and checkbox object listings.) behavior direction scrollAmount scrollDelay width MARQUEE 35 start() stop() (1) (1)From IE, but implemented in N7/Mozilla. altKey bubbles button cancelBubble cancelable charCode clientX clientY ctrlKey currentTarget detail eventPhase isChar keyCode layerX layerY metaKey originalTarget pageX pageY relatedTarget screenX screenY shiftKey target timeStamp type view (None)initEvent("type",bubble ,cancelable ) initKeyEvent("type", evtArgs ) initMouseEvent("type", evtArgs ) initMutationEvent("type", evtArgs ) initUIEvent("type", evtArgs ) preventDefault() stopPropagation() event(1) (1)Not implemented in IE through 6. media type (None)(None) STYLE cssRules[] disabled href media ownerNode(1) ownerRule(1) parentStyleSheet title type (None)deleteRule(index )(1) insertRule("rule",index )(1) styleSheet (1)Not implemented in IE through 5.5. align altW6 baseURIN7 borderW6 code codeBase codeType contentDocument(1) height hspace name object type vspace width OBJECT cssText(2) parentStyleSheet(2) selectorText style type(1) (None)(None) cssRule (1)Not implemented in IE through 6. (2)Not implemented in IE through 6, but implemented in IE5/Mac. 13 Page 4 of 4 — W3C DOM (IE5+, NN6+, Mozilla, Safari) Quick Reference© 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. JSB5 W3C DOM Compatibility Guide Baseline browsers for this section are IE5, NN6, Mozilla 1, and Safari 1. An item with no notation is compatible with these 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 object. 26 26 26 (1)Not implemented in IE through 6. charset disabled href hreflang media rel rev sheet(1) target type (None)(None) LINK 36 defer event htmlFor src text type (None)(None) SCRIPT 36 align height name width onload onscroll (None) EMBED 40 align altW6 archiveW6 code codeBase data height hspace name type useMapW6 vspace width APPLET 40 40 25 (1)Not implemented in IE through 6. (1)Method of the static String object. (2)Added behavior in N4 includes: ability to accept a regexp parameter; second parameter (limit integer) to limit the number of splits to be included; a space string parameter signifying any white space character. constructorN4, IE4 length prototypeN4, J2 anchor("anchorName") big() blink() bold() charAt(index ) charCodeAt([i])N4, IE4 concat(string2 )N4, IE4 fixed() fontcolor(#rrggbb) fontsize(1to7) fromCharCode(n1...)(1),N4, IE4 indexOf("str" [,i]) italics() lastIndexOf("str" [,i]) link(URL) localeCompare()N6, W5.5 match(regexp)N4, IE4 replace(regexp,str)N4, IE4 search(regexp)N4, IE4 slice(i,j)N4, IE4 small() split(char)N3, (2), IE4 strike() sub() substr(start,length )N4, IE4 substring(intA , intB ) sup() toLocaleLowerCase()N6, W5.5 toLocaleUpperCase()N6, W5.5 toLowerCase() toString()N4, IE4 toUpperCase() valueOf()N4, IE4 String (1)Property of the static RegExp object. (2)Returns an array with properties: index, input, [0], [1],...[n]. global ignoreCaseM5,W5.5 input(1), IE5.5 lastIndex multiline(1), W5.5 lastMatch(1), W5.5 lastParen(1), W5.5 leftContext(1),W5.5 prototype rightContext(1) source $1...$9 compile(regexp) exec("string")(2) test("string") str.match(regexp) str.replace(regexp,str) str.search(regexp) str.split(regexp[,limit ]) Regular ExpressionsN4,IE4 arguments arityN4 caller constructorN4, IE4 length prototype apply(this , argsArray)N6, W5.5 call(this [,arg1[,...argN]])N6, W5.5 toString() valueOf() FunctionN3,J2 prototype constructor descriptionW5 fileNameN6 lineNumberN6 messageN6, IE5.5 nameN6, IE5.5 numberW5 toString() ErrorN6,W5 constructorN4, IE4 MAX_VALUE IE4 MIN_VALUE IE4 NaNIE4 NEGATIVE_INFINITY IE4 POSITIVE_INFINITY IE4 prototype toExponential(n)N6, W5.5 toFixed(n)N6, IE5.5 toLocaleString()N6, W5.5,M5 toString([radix ])N4, IE4 toPrecision(n)N6, W5.5 valueOf()N4, IE4 NumberN3,J2 constructorN4, IE4 prototypeN3, IE4 getFullYear()N4, J2 getYear() getMonth() getDate() getDay() getHours() getMinutes() getSeconds() getTime() getMilliseconds()N4, J2 getUTCFullYear()N4, J2 getUTCMonth()N4, J2 getUTCDate()N4, J2 getUTCDay()N4, J2 getUTCHours()N4, J2 getUTCMinutes()N4, J2 getUTCSeconds()N4, J2 getUTCMilliseconds()N4, J2 setYear(val ) setFullYear(val )N4, J2 setMonth(val ) setDate(val ) setDay(val ) setHours(val ) setMinutes(val ) setSeconds(val ) setMilliseconds(val )N4, J2 setTime(val ) setUTCFullYear(val )N4, J2 setUTCMonth(val )N4, J2 setUTCDate(val )N4, J2 setUTCDay(val )N4, J2 setUTCHours(val )N4, J2 setUTCMinutes(val )N4, J2 setUTCSeconds(val )N4, J2 setUTCMilliseconds(val )N4, J2 getTimezoneOffset() toDateString()W5.5 toGMTString() toLocaleDateString()W5.5, N6 toLocaleString() toLocaleTimeString()W5.5, N6 toString() toTimeString()IE5.5 toUTCString()N4, J2
本文档为【JavaScript and Browser Objects Quick Reference】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_309639
暂无简介~
格式:pdf
大小:400KB
软件:PDF阅读器
页数:14
分类:互联网
上传时间:2009-08-13
浏览量:22