WEB教程基地:www.91ctc.com为你搭建学习WEB技术的优秀平台
网站地图 加入收藏 设为首页
您的位置:本站首页>>前端特效>>Javascript教程:第二十二讲―Javascript语句:for-in语句详解

Javascript教程:第二十二讲―Javascript语句:for-in语句详解

[ 录入者:91ctc | 时间:2013-02-20 17:00:14 | 作者: 91ctc| 来源:本站 | 浏览: 次 ]

for-in 语句

for-in  语句用于对数组或者对象的属性进行循环操作

for-in  循环中的代码每执行一次,就会对数组的元素或者对象的属性进行一次操作。

语法:

for (变量 in 对象)
{
    在此执行代码
}

例如:

JavaScript Code复制内容到剪贴板

  1. for (var propName in window){   

  2.     document.write(propName);   

  3.     document.write("<br/>");   

  4. }  

运行后,页面上会显示(BOM中window对象的所有属性,注意:通过for-in循环输出的属性名的顺序是不可预测的,因为ECMAscript对象的属性没有顺序):

window
top
location
__ActiveXObjectStub
external
v8Locale
document
propName
CustomEvent
HTMLFontElement
SVGFESpotLightElement
HTMLBaseFontElement
Uint32Array
Entity
StyleSheetList
StorageEvent
applicationCache
OverflowEvent
CanvasGradient
screenY
webkitIDBObjectStore
HTMLSpanElement
SVGTSpanElement
SVGFEMergeElement
PageTransitionEvent
innerWidth
HTMLTableSectionElement
webkitIDBIndex
personalbar
SVGAnimatedEnumeration
WebKitCSSKeyframeRule
webkitStorageInfo
SVGAltGlyphElement
SVGFEFuncAElement
SVGFEDistantLightElement
SVGFETurbulenceElement
webkitIDBDatabaseException
HTMLKeygenElement
SVGAltGlyphDefElement
SVGFEFuncBElement
WebGLProgram
FileError
SVGCursorElement
SVGAnimatedString
Node
Comment
HTMLOptionElement
WebGLRenderbuffer
HTMLAllCollection
NodeList
menubar
SVGAngle
SVGDefsElement
webkitIDBKeyRange
scrollX
frames
SVGFEDropShadowElement
webkitIndexedDB
Int16Array
localStorage
WebGLTexture
HTMLInputElement
Int8Array
SVGRectElement
SVGFETileElement
parent
HTMLTableRowElement
WebKitAnimationEvent
HTMLMediaElement
MessageEvent
MediaController
SVGPathSegCurvetoCubicSmoothRel
HTMLLIElement
StyleSheet
SVGElement
SVGFEColorMatrixElement
HTMLDivElement
WebGLActiveInfo
status
webkitIDBTransaction
WebGLBuffer
SharedWorker
SVGHKernElement
Notation
Attr
ProcessingInstruction
SVGImageElement
frameElement
SVGPathElement
SVGPolylineElement
webkitIDBDatabase
Blob
FileList
performance
SVGSwitchElement
HTMLModElement
CDATASection
CSSRuleList
FormData
DeviceOrientationEvent
SVGAnimatedAngle
SVGPatternElement
Range
NamedNodeMap
HTMLTableElement
navigator
SVGMetadataElement
Text
SVGPathSegLinetoAbs
SVGPathSegLinetoVerticalRel
DocumentFragment
CSSFontFaceRule
WebSocket
TextTrackList
HTMLMapElement
SVGNumberList
SVGFEMergeNodeElement
locationbar
HTMLAnchorElement
TouchEvent
CanvasRenderingContext2D
SVGZoomEvent
SVGFontElement
DOMException
scrollbars
HTMLScriptElement
HTMLTableCellElement
WebKitPoint
SVGLineElement
HTMLDListElement
scrollY
SVGSetElement
SVGPathSegCurvetoCubicAbs
HashChangeEvent
event
SVGAnimateTransformElement
TextTrackCue
screenX
SVGColor
SVGRadialGradientElement
SVGFEDiffuseLightingElement
crypto
webkitIDBCursor
HTMLLegendElement
SVGLinearGradientElement
HTMLUnknownElement
HTMLCollection
HTMLHeadingElement
HTMLParagraphElement
MessagePort
SVGFEMorphologyElement
SVGPointList
TextTrack
SVGFEConvolveMatrixElement
SVGFontFaceFormatElement
SVGForeignObjectElement
HTMLImageElement
HTMLVideoElement
SVGFEOffsetElement
webkitAudioPannerNode
pageXOffset
pageYOffset
SVGTRefElement
SVGFEBlendElement
SVGFilterElement
SVGRenderingIntent
WebKitTransitionEvent
CSSStyleSheet
HTMLBaseElement
SVGNumber
SVGAnimatedRect
SVGTextContentElement
MediaList
SVGAnimateMotionElement
SVGAnimatedNumber
SVGPoint
webkitPeerConnection
MimeType
SVGFECompositeElement
SVGUseElement
SVGPathSegCurvetoQuadraticAbs
SVGElementInstanceList
SVGTitleElement
DOMSettableTokenList
webkitIDBRequest
SVGFEFuncGElement
HTMLObjectElement
WheelEvent
statusbar
outerHeight
HTMLFrameElement
HTMLTableCaptionElement
CSSStyleRule
SVGAnimatedPreserveAspectRatio
CSSImportRule
webkitNotifications
defaultStatus
screen
CompositionEvent
Uint16Array
SVGAnimatedNumberList
ImageData
SVGAElement
SVGTextElement
SVGViewElement
XMLHttpRequest
SVGFEFloodElement
File
HTMLUListElement
HTMLMetaElement
DOMParser
DOMTokenList
SVGFontFaceElement
HTMLFrameSetElement
MediaError
EventSource
SVGDocument
SQLException
DOMStringList
ClientRect
SVGFEGaussianBlurElement
devicePixelRatio
screenLeft
Float32Array
SVGUnitTypes
SVGAnimatedBoolean
HTMLIFrameElement
CSSPageRule
clientInformation
SVGPathSeg
webkitIDBDatabaseError
Int32Array
CSSStyleDeclaration
HTMLLabelElement
SVGPaint
HTMLOutputElement
UIEvent
CSSValueList
SVGPathSegCurvetoQuadraticSmoothAbs
SVGComponentTransferFunctionElement
XMLSerializer
SVGLength
HTMLElement
SpeechInputEvent
TextTrackCueList
HTMLHtmlElement
outerWidth
XMLHttpRequestUpload
sessionStorage
Image
SVGTransformList
HTMLTrackElement
SVGAnimateColorElement
PopStateEvent
TrackEvent
webkitURL
SVGStringList
HTMLIsIndexElement
SVGCircleElement
SVGSymbolElement
SVGTransform
HTMLDocument
HTMLTableColElement
SVGPreserveAspectRatio
Float64Array
KeyboardEvent
CSSPrimitiveValue
SVGPathSegMovetoRel
NodeFilter
OfflineAudioCompletionEvent
XPathEvaluator
SVGPathSegLinetoVerticalAbs
SVGAnimatedInteger
HTMLDirectoryElement
Element
HTMLStyleElement
RGBColor
MouseEvent
XPathResult
XMLHttpRequestException
name
WebKitBlobBuilder
HTMLAppletElement
ClientRectList
ArrayBuffer
Worker
HTMLMeterElement
SVGGElement
EntityReference
HTMLTextAreaElement
ProgressEvent
RangeException
DocumentType
Uint8Array
HTMLCanvasElement
SVGScriptElement
SVGTextPositioningElement
SVGPathSegCurvetoCubicSmoothAbs
BeforeLoadEvent
closed
SVGFontFaceSrcElement
SVGStopElement
Document
webkitAudioContext
offscreenBuffering
CSSCharsetRule
WebKitCSSTransformValue
MutationEvent
SVGPathSegLinetoRel
SVGPathSegLinetoHorizontalAbs
SVGAnimatedLengthList
Clipboard
SVGStyleElement
SVGException
SVGMarkerElement
SVGAltGlyphItemElement
CSSMediaRule
HTMLLinkElement
SVGPolygonElement
SVGClipPathElement
SVGMissingGlyphElement
MessageChannel
SVGSVGElement
TextMetrics
HTMLBRElement
styleMedia
XMLDocument
HTMLPreElement
TimeRanges
HTMLProgressElement
SVGPathSegClosePath
SVGLengthList
SVGAnimatedTransformList
SVGElementInstance
DOMStringMap
console
HTMLSourceElement
HTMLOListElement
HTMLFieldSetElement
SVGFESpecularLightingElement
SVGFEFuncRElement
SVGPathSegCurvetoQuadraticSmoothRel
SVGMatrix
FileReader
WebGLRenderingContext
WebKitFlags
SVGRect
SVGDescElement
CloseEvent
AudioProcessingEvent
CanvasPattern
defaultstatus
Plugin
SVGMPathElement
MimeTypeArray
HTMLMenuElement
WebGLShader
SVGMaskElement
WebKitCSSKeyframesRule
SVGPathSegArcAbs
HTMLHRElement
HTMLTitleElement
WebKitCSSMatrix
self
XMLHttpRequestProgressEvent
SVGFEPointLightElement
HTMLEmbedElement
MediaStreamEvent
HTMLFormElement
EventException
CSSValue
WebGLUniformLocation
HTMLSelectElement
WebGLContextEvent
HTMLMarqueeElement
SVGPathSegList
HTMLButtonElement
SVGGlyphElement
CharacterData
SVGTextPathElement
innerHeight
WebGLFramebuffer
SVGPathSegCurvetoCubicRel
HTMLBodyElement
Option
DOMImplementation
Rect
Audio
screenTop
HTMLAudioElement
opener
SVGPathSegMovetoAbs
SVGFontFaceNameElement
SVGPathSegLinetoHorizontalRel
SVGAnimateElement
ErrorEvent
SVGFEImageElement
TextEvent
XPathException
SVGEllipseElement
HTMLQuoteElement
SVGGradientElement
SVGFEDisplacementMapElement
SVGGlyphRefElement
SVGAnimatedLength
Event
PluginArray
XSLTProcessor
SVGVKernElement
Counter
HTMLParamElement
SVGFontFaceUriElement
SVGPathSegArcRel
toolbar
length
HTMLPropertiesCollection
Storage
webkitIDBFactory
SVGPathSegCurvetoQuadraticRel
HTMLOptGroupElement
HTMLHeadElement
history
CSSRule
SVGFEComponentTransferElement
HTMLAreaElement
DataView
ononline
onprogress
ondragover
onemptied
onpagehide
onmouseout
onloadstart
onwebkitanimationend
onwebkitanimationstart
oncanplay
onsearch
onload
onmousemove
ondblclick
onended
onmessage
onwebkitanimationiteration
onselect
onclick
onloadedmetadata
focus
onbeforeunload
ondragleave
onkeydown
sogouClose
onchange
ondeviceorientation
oncanplaythrough
onkeyup
onloadeddata
onresize
onwebkittransitionend
ondrop
onsuspend
ondragend
onwaiting
onabort
oninput
onseeking
onunload
onstorage
onhashchange
onplay
onreset
ondrag
close
onstalled
onseeked
onpopstate
ondragenter
onpageshow
onmouseup
ontimeupdate
onerror
onsubmit
blur
onpause
postMessage
webkitPostMessage
onmouseover
onkeypress
onplaying
onmousewheel
onoffline
oncontextmenu
onfocus
onscroll
onratechange
oninvalid
onmousedown
ondurationchange
ondragstart
onblur
onvolumechange
getSelection
print
stop
open
showModalDialog
alert
confirm
prompt
find
scrollBy
scrollTo
scroll
moveBy
moveTo
resizeBy
resizeTo
matchMedia
setTimeout
clearTimeout
setInterval
clearInterval
webkitRequestAnimationFrame
webkitCancelRequestAnimationFrame
atob
btoa
addEventListener
removeEventListener
captureEvents
releaseEvents
SgActiveXObject
SgInjectCSS
getComputedStyle
getMatchedCSSRules
webkitConvertPointFromPageToNode
webkitConvertPointFromNodeToPage
openDatabase
webkitRequestFileSystem
webkitResolveLocalFileSystemURL
dispatchEvent
TEMPORARY
PERSISTENT

PS:如果您对本文有纠错、质疑、转载、举报等问题时,请加入到网站Q&Q&群:86783981(验证信息:91ctc.com)提交您的问题,让大伙一块讨论。谢谢您的支持,计算机教程中心网将会一如既往的提供优秀资源助您一臂之力!
关闭】【返回顶部

您可能感兴趣的文章
91ctc.com 网络先锋,引领科技,本站原创作品[转载请注明出处]。网站Q&Q&群:86783981(验证信息:91ctc.com)
Copyright© 2010-2017 计算机教程中心网 . All rights reserved. 苏ICP备11081842号