您的位置:首页 > Web前端 > JavaScript

在 JavaScript 核心语言中,全局对象的预定义属性都是不可枚举的,所有可以用 for/in 循环列出所有隐式或显式声明的全局变量

2015-04-10 21:41 811 查看
在 JavaScript 核心语言中,全局对象的预定义属性都是不可枚举的,所有可以用 for/in 循环列出所有隐式或显式声明的全局变量,如下所示:
var variables = "";

for (var name in this)
{
variables += name + "<br />";
}

document.write(variables);

结果:
top
window
location
external
chrome
document
variables
speechSynthesis
localStorage
sessionStorage
applicationCache
webkitStorageInfo
indexedDB
webkitIndexedDB
crypto
CSS
performance
console
devicePixelRatio
styleMedia
parent
opener
frames
self
defaultstatus
defaultStatus
status
name
length
closed
pageYOffset
pageXOffset
scrollY
scrollX
screenTop
screenLeft
screenY
screenX
innerWidth
innerHeight
outerWidth
outerHeight
offscreenBuffering
frameElement
clientInformation
navigator
toolbar
statusbar
scrollbars
personalbar
menubar
locationbar
history
screen
postMessage
close
bl
4000
ur
focus
onautocompleteerror
onautocomplete
ondeviceorientation
ondevicemotion
onunload
onstorage
onpopstate
onpageshow
onpagehide
ononline
onoffline
onmessage
onlanguagechange
onhashchange
onbeforeunload
onwaiting
onvolumechange
ontoggle
ontimeupdate
onsuspend
onsubmit
onstalled
onshow
onselect
onseeking
onseeked
onscroll
onresize
onreset
onratechange
onprogress
onplaying
onplay
onpause
onmousewheel
onmouseup
onmouseover
onmouseout
onmousemove
onmouseleave
onmouseenter
onmousedown
onloadstart
onloadedmetadata
onloadeddata
onload
onkeyup
onkeypress
onkeydown
oninvalid
oninput
onfocus
onerror
onended
onemptied
ondurationchange
ondrop
ondragstart
ondragover
ondragleave
ondragenter
ondragend
ondrag
ondblclick
oncuechange
oncontextmenu
onclose
onclick
onchange
oncanplaythrough
oncanplay
oncancel
onblur
onabort
onwheel
onwebkittransitionend
onwebkitanimationstart
onwebkitanimationiteration
onwebkitanimationend
ontransitionend
onsearch
getSelection
print
stop
open
alert
confirm
prompt
find
scrollBy
scrollTo
scroll
moveBy
moveTo
resizeBy
resizeTo
matchMedia
getComputedStyle
getMatchedCSSRules
webkitConvertPointFromPageToNode
webkitConvertPointFromNodeToPage
requestAnimationFrame
cancelAnimationFrame
webkitRequestAnimationFrame
webkitCancelAnimationFrame
webkitCancelRequestAnimationFrame
captureEvents
releaseEvents
btoa
atob
setTimeout
clearTimeout
setInterval
clearInterval
TEMPORARY
PERSISTENT
webkitRequestFileSystem
webkitResolveLocalFileSystemURL
openDatabase
addEventListener
removeEventListener
dispatchEvent
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐